Created
December 3, 2020 18:17
-
-
Save oldsj/416087bad5fd34498623ee285db6cc94 to your computer and use it in GitHub Desktop.
An Ideal Dockerfile for Rust
This file contains 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
FROM rust:slim as builder | |
WORKDIR /app | |
RUN rustup default nightly | |
RUN rustup target add x86_64-unknown-linux-musl --toolchain=nightly | |
WORKDIR /app/gcpizza | |
COPY Cargo.toml Cargo.lock ./ | |
COPY src ./src | |
RUN cargo build --target x86_64-unknown-linux-musl --release | |
FROM scratch as runtime | |
COPY --from=builder /app/gcpizza/target/x86_64-unknown-linux-musl/release/gcpizza . | |
COPY Rocket.toml . | |
USER 1000 | |
EXPOSE 8080 | |
CMD ["./gcpizza"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment