-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
10 deletions.
There are no files selected for viewing
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
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"] |