-
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.
use cargo chef for dockerfile builds + switch to docker actions for c…
…ache storage
- Loading branch information
1 parent
df00bdc
commit 4808f9d
Showing
2 changed files
with
25 additions
and
25 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
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,15 +1,19 @@ | ||
FROM rust:1.72.0-alpine AS chef | ||
FROM rust:1.72.0-alpine AS base | ||
RUN apk add musl-dev musl-utils | ||
RUN cargo install cargo-chef | ||
|
||
FROM base AS chef | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
COPY --from=chef /recipe.json recipe.json | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
COPY . . | ||
RUN cargo build --target x86_64-unknown-linux-musl --release | ||
RUN cargo build --target x86_64-unknown-linux-musl --release --bin sandbox-api | ||
|
||
FROM alpine:latest | ||
COPY --from=builder /target/x86_64-unknown-linux-musl/release/sandbox-api . | ||
ENTRYPOINT ["/sandbox-api"] | ||
FROM alpine AS runtime | ||
RUN addgroup -S app && adduser -S app -G app | ||
COPY --from=builder /target/x86_64-unknown-linux-musl/release/sandbox-api /usr/local/bin/ | ||
USER app | ||
CMD ["/usr/local/bin/sandbox-api"] |