Skip to content

Commit

Permalink
chore: update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun authored and DevinR528 committed Oct 14, 2022
1 parent b265280 commit 8f60c09
Showing 1 changed file with 16 additions and 10 deletions.
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"]

0 comments on commit 8f60c09

Please sign in to comment.