Created
August 28, 2024 13:35
-
-
Save ddanielsantos/923e5d6fecdc01df5d4476b7dab358c6 to your computer and use it in GitHub Desktop.
rust_api_dockerfile
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 RUST_VERSION=1.79 | |
FROM lukemathwalker/cargo-chef:latest-rust-${RUST_VERSION} 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 cargo chef cook --release --recipe-path recipe.json | |
COPY . . | |
ENV SQLX_OFFLINE=true | |
RUN cargo build --release --bin simple-api | |
FROM gcr.io/distroless/cc-debian12 AS runtime | |
WORKDIR /app | |
COPY --from=builder /app/target/release/simple-api /bin/server | |
EXPOSE 8000 | |
ENTRYPOINT ["/bin/server"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment