- Update COPY paths in all 3 Dockerfiles for crates/bin/services/testing layout - Migrate service image builds from internal GitLab registry to SCW CR - Update Kaniko auth to use SCW credentials (nologin + SCW_SECRET_KEY) - Remove --insecure-registry flags (SCW CR is HTTPS) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
2.1 KiB
Docker
77 lines
2.1 KiB
Docker
# Multi-stage build: Node (dashboard) + Rust (web-gateway) + slim runtime
|
|
# Usage: docker build -f infra/docker/Dockerfile.web-gateway .
|
|
|
|
# =============================================================================
|
|
# Stage 1: Build web-dashboard static assets
|
|
# =============================================================================
|
|
FROM node:22-slim AS dashboard
|
|
|
|
WORKDIR /dashboard
|
|
|
|
COPY web-dashboard/package.json web-dashboard/package-lock.json ./
|
|
RUN npm ci
|
|
|
|
COPY web-dashboard/ ./
|
|
RUN npm run build
|
|
|
|
# =============================================================================
|
|
# Stage 2: Build web-gateway Rust binary
|
|
# =============================================================================
|
|
FROM rust:1.89-slim-bookworm AS builder
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
pkg-config \
|
|
libssl-dev \
|
|
protobuf-compiler \
|
|
perl \
|
|
make \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /build
|
|
|
|
# Copy workspace manifests first for layer caching
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY .sqlx ./.sqlx
|
|
|
|
# Copy workspace directories (post-restructure layout)
|
|
COPY crates ./crates
|
|
COPY bin ./bin
|
|
COPY services ./services
|
|
COPY testing ./testing
|
|
|
|
ENV SQLX_OFFLINE=true
|
|
|
|
RUN cargo build --release -p web-gateway \
|
|
&& strip target/release/web-gateway
|
|
|
|
# =============================================================================
|
|
# Stage 3: Runtime
|
|
# =============================================================================
|
|
FROM debian:bookworm-slim
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
libssl3 \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN groupadd -g 1000 foxhunt \
|
|
&& useradd -u 1000 -g foxhunt -m -s /bin/false foxhunt
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /build/target/release/web-gateway ./web-gateway
|
|
COPY --from=dashboard /dashboard/dist/ ./static/
|
|
|
|
RUN chmod +x ./web-gateway
|
|
|
|
EXPOSE 3000
|
|
|
|
USER foxhunt
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD curl -f http://localhost:3000/health || exit 1
|
|
|
|
ENTRYPOINT ["./web-gateway"]
|