Created
November 4, 2018 20:33
-
-
Save sguzman/5c0c9dc43426086d54571be125e69cdb to your computer and use it in GitHub Desktop.
Dockerfile for rustup with building deps first
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
FROM liuchong/rustup:musl AS base | |
RUN mkdir app | |
WORKDIR ./app | |
COPY ./Cargo.lock ./Cargo.lock | |
COPY ./Cargo.toml ./Cargo.toml | |
RUN rustup target add x86_64-unknown-linux-musl | |
RUN rustup install nightly | |
RUN cargo install cargo-build-deps --verbose --color always | |
RUN cargo build-deps --release | |
ADD src src | |
ARG name=weighted-consumer | |
RUN cargo build --package $name --bin $name --verbose --jobs 2 --all-features --release --target=x86_64-unknown-linux-musl --color always | |
FROM scratch | |
COPY --from=base /root/app/target/x86_64-unknown-linux-musl/release/weighted-consumer /main | |
ENTRYPOINT ["/main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment