# ── Builder stage ────────────────────────────────────────────── FROM rust:latest AS builder WORKDIR /app COPY . . RUN cargo build --release --workspace --jobs 2 # ── Runtime base (shared) ───────────────────────────────────── FROM debian:trixie-slim AS runtime-base RUN apt-get update && apt-get install -y libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/* WORKDIR /app # ── Gateway (monolithic — backward compat) ──────────────────── FROM runtime-base AS gateway COPY --from=builder /app/target/release/gateway . COPY web ./web CMD ["./gateway"] # ── Worker ──────────────────────────────────────────────────── FROM runtime-base AS worker-runtime COPY --from=builder /app/target/release/worker . CMD ["./worker"] # ── Control Plane ───────────────────────────────────────────── FROM runtime-base AS control-runtime COPY --from=builder /app/target/release/control . COPY web ./web CMD ["./control"] # ── Proxy ───────────────────────────────────────────────────── FROM runtime-base AS proxy-runtime COPY --from=builder /app/target/release/proxy . CMD ["./proxy"]