Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile #49

Merged
merged 1 commit into from
Oct 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
FROM ekidd/rust-musl-builder:latest as builder
WORKDIR /home/rust/src
FROM lukemathwalker/cargo-chef:latest-rust-latest 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 . .
RUN cargo build --locked --release
RUN mkdir -p build-out/
RUN cp target/x86_64-unknown-linux-musl/release/cargo-sort build-out/
RUN strip build-out/cargo-sort
RUN cargo build --verbose --locked --release
RUN strip /app/target/release/cargo-sort

FROM scratch
WORKDIR /app
COPY --from=builder /home/rust/src/build-out/cargo-sort .
FROM debian:buster-slim AS runtime
WORKDIR app
COPY --from=builder /app/target/release/cargo-sort /usr/local/bin
USER 1000:1000
CMD ["./cargo-sort"]
ENTRYPOINT ["cargo-sort"]