-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: clux <[email protected]>
- Loading branch information
Showing
5 changed files
with
25 additions
and
27 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,18 +1,12 @@ | ||
FROM rust:1.72-alpine as builder | ||
RUN apk add --no-cache musl-dev | ||
FROM clux/muslrust:stable AS builder | ||
COPY Cargo.* . | ||
COPY version.rs version.rs | ||
RUN --mount=type=cache,target=/volume/target \ | ||
--mount=type=cache,target=/root/.cargo/registry \ | ||
cargo build --release --bin version && \ | ||
mv /volume/target/x86_64-unknown-linux-musl/release/version . | ||
|
||
# Cache downloaded + built dependencies | ||
COPY Cargo.toml Cargo.lock / | ||
RUN echo 'fn main() {}' > /version.rs && \ | ||
cargo build --release && \ | ||
rm -f /version.rs | ||
|
||
# Build our code | ||
COPY version.rs / | ||
RUN cargo build --release | ||
|
||
# Runtime | ||
FROM cgr.dev/chainguard/static | ||
COPY --from=builder --chown=nonroot:nonroot /volume/version /app/ | ||
EXPOSE 8080 | ||
COPY --from=builder --chown=nonroot:nonroot /target/release/version / | ||
ENTRYPOINT ["/version"] | ||
ENTRYPOINT ["/app/version"] |
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
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