Files
foxhunt/infra/docker/Dockerfile.web-gateway-runtime
jgrusewski c5db5aa39e perf(ci): compile once with PVC sccache, package with Kaniko
Split the build pipeline: one compile-services job builds all 8 service
binaries with PVC-backed sccache, saves as artifacts. Then 9 Kaniko jobs
just package pre-built binaries into slim runtime images (~30s each).

Before: 9 parallel Kaniko jobs each doing full cargo build --release
  (~20min each, no sccache, 9x duplicated dep compilation)
After:  1 compile job with sccache (~5min cached) + 9 package jobs (~30s)

- Add compile stage between test and build
- Add Dockerfile.runtime (minimal debian + pre-built binary)
- Add Dockerfile.web-gateway-runtime (Node dashboard + pre-built binary)
- Keep Dockerfile.training via Kaniko (needs CUDA dev image for H100)
- Remove all SCCACHE_BUCKET build-args from service builds
- Use dir:// context for Kaniko (only sends build-out/ dir, not full repo)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 00:50:25 +01:00

46 lines
1.4 KiB
Docker

# Web-gateway runtime: Node dashboard build + pre-built Rust binary
# The Rust binary is compiled in CI (with PVC sccache) and passed via build context
# Usage: docker build -f Dockerfile.web-gateway-runtime .
# =============================================================================
# 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: Runtime (pre-built binary + dashboard assets)
# =============================================================================
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=dashboard /dashboard/dist/ ./static/
COPY build-out/web-gateway ./web-gateway
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"]