Created
March 30, 2024 17:30
-
-
Save agaviria/844fdc65707ef9931658bacf46849be0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG VCS_REVISION | |
FROM docker.io/lukemathwalker/cargo-chef:0.1.66-rust-1.76 AS chef | |
# set the work directory for the backend application | |
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 cargo chef cook --release --recipe-path recipe.json | |
COPY . . | |
ARG VCS_REVISION | |
RUN VCS_REVISION=$VCS_REVISION cargo build --release | |
FROM gcr.io/distroless/cc-debian12 | |
# Copy application binary from the image 'builder' | |
COPY --from=builder /app/target/release/pulse-api / | |
# Instead of exposing port we run the binary | |
CMD ["./pulse-api"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quick Rust Dockerfile template