Last active
May 8, 2023 13:36
-
-
Save nayato/18f03329c8df3eb5461e2b2b8ec23b9f to your computer and use it in GitHub Desktop.
Dockerfile for rust multistage build sample
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 rustlang/rust:nightly as builder | |
WORKDIR /app/src | |
RUN USER=root cargo new --bin ht | |
COPY Cargo.toml Cargo.lock ./ht/ | |
WORKDIR /app/src/ht | |
RUN cargo build --release | |
COPY ./ ./ | |
RUN cargo build --release | |
FROM debian:stable-slim | |
WORKDIR /app | |
RUN apt update \ | |
&& apt install -y openssl ca-certificates \ | |
&& apt clean \ | |
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
EXPOSE 80 443 | |
COPY --from=builder /app/src/ht/target/release/ht /app/src/ht/gateway.tests.com.pfx ./ | |
CMD ["/app/ht"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment