Files
foxhunt/infra/docker/Dockerfile.web-gateway
jgrusewski 3db5c950c7 infra: deploy all services to Kapsule cluster
- Fix DB pool connect/acquire timeouts (50ms→5s) for cluster networking
  (pool-level timeouts, not query timeouts — HFT query timeout stays at 800μs)
- Fix secret key references (DATABASE_PASSWORD→db-password) in all manifests
- Fix api-gateway port (50050→50051) to match actual gRPC listen port
- Fix web-gateway health probe path (/api/health→/health)
- Fix S3 endpoint region (nl-ams→fr-par) in ml-training-service
- Add TLS cert volume mount for ml-training-service
- Add BENZINGA_API_KEY placeholder for backtesting-service startup
- Remove always-on nodeSelector from services (let autoscaler handle)
- Add serve subcommand to ml-training-service container

All 10 pods (3 databases + 7 services) now 1/1 Running.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 17:18:47 +01:00

93 lines
2.5 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 all workspace crate directories
COPY trading_engine ./trading_engine
COPY risk ./risk
COPY risk-data ./risk-data
COPY trading-data ./trading-data
COPY fxt ./fxt
COPY ml ./ml
COPY ml-data ./ml-data
COPY data ./data
COPY backtesting ./backtesting
COPY adaptive-strategy ./adaptive-strategy
COPY common ./common
COPY storage ./storage
COPY model_loader ./model_loader
COPY market-data ./market-data
COPY database ./database
COPY config ./config
COPY web-gateway ./web-gateway
COPY ctrader-openapi ./ctrader-openapi
COPY services ./services
COPY tests ./tests
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"]