# Build the application from source. FROM rust:1.80.1-slim@sha256:e8e40c50bfb54c0a76218f480cc69783b908430de87b59619c1dca847fdbd753 AS rust-builder ENV CARGO_HOME="/cache/cargo" WORKDIR /app COPY Cargo.toml Cargo.lock ./ COPY src/ ./src/ RUN --mount=type=cache,target=${CARGO_HOME} \ cargo build --release --locked # Deploy the application binary into a lean image. FROM gcr.io/distroless/cc-debian12:latest@sha256:3b75fdd33932d16e53a461277becf57c4f815c6cee5f6bc8f52457c095e004c8 AS runtime LABEL maintainer="DeadNews " COPY --from=rust-builder /app/target/release/deadnews-template-rust /usr/local/bin/deadnews-template-rust USER nonroot:nonroot EXPOSE 8080 HEALTHCHECK NONE CMD ["deadnews-template-rust"]