FROM rust:latest AS builder WORKDIR /usr/src/app RUN apt-get update && apt-get install -y \ pkg-config \ libssl-dev \ && rm -rf /var/lib/apt/lists/* COPY Cargo.toml Cargo.lock ./ COPY crates ./crates COPY apps ./apps ENV CARGO_BUILD_JOBS=2 RUN cargo build --release --bin gateway FROM debian:trixie-slim AS runtime RUN apt-get update && apt-get install -y \ ca-certificates \ libssl3 \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 appuser WORKDIR /app COPY --from=builder /usr/src/app/target/release/gateway ./gateway USER appuser CMD ["./gateway"]