FROM lukemathwalker/cargo-chef:latest-rust-1.89.0 AS chef WORKDIR /app FROM chef AS planner COPY . . RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder COPY --from=planner /app/recipe.json recipe.json RUN apt update -y \ && apt install -y --no-install-recommends clang mold RUN cargo chef cook --release --recipe-path recipe.json COPY . . ENV SQLX_OFFLINE=true RUN cargo build --release --bin zero2prod FROM debian:bookworm-slim AS runtime WORKDIR /app RUN apt update -y \ && apt install -y --no-install-recommends openssl ca-certificates \ && apt autoremove -y \ && apt clean -y \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/target/release/zero2prod zero2prod COPY configuration configuration ENV APP_ENVIRONMENT=production ENTRYPOINT [ "./zero2prod" ]