-
Notifications
You must be signed in to change notification settings - Fork 0
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,17 +1,23 @@ | ||
FROM rust:1.77-alpine as builder | ||
|
||
WORKDIR /usr/src/genuuid | ||
FROM rust:1.77-alpine AS chef | ||
RUN apk update && apk add --no-cache musl-dev | ||
COPY ./Cargo.lock ./Cargo.lock | ||
COPY ./Cargo.toml ./Cargo.toml | ||
RUN mkdir src/ | ||
RUN touch src/lib.rs | ||
RUN cargo build --release --target=x86_64-unknown-linux-musl | ||
WORKDIR /app | ||
RUN cargo install cargo-chef --locked | ||
|
||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo install --path . --target=x86_64-unknown-linux-musl | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS cacher | ||
COPY --from=planner /app/recipe.json recipe.json | ||
RUN cargo chef cook --recipe-path recipe.json --release --target=x86_64-unknown-linux-musl | ||
|
||
FROM chef AS builder | ||
COPY . . | ||
COPY --from=cacher /app/target target | ||
RUN cargo build --release --target=x86_64-unknown-linux-musl | ||
|
||
FROM scratch | ||
LABEL org.opencontainers.image.source https://github.com/bouzuya/genuuid | ||
ENV PORT=8080 | ||
COPY --from=builder /usr/local/cargo/bin/genuuid /usr/local/bin/genuuid | ||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/genuuid /usr/local/bin/genuuid | ||
ENTRYPOINT ["genuuid"] |