-
Notifications
You must be signed in to change notification settings - Fork 111
Add Dockerfile #969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Dockerfile #969
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Improve build speed with cached deps | ||
| ARG RUST_VERSION=1.70.0 | ||
| FROM lukemathwalker/cargo-chef:latest-rust-${RUST_VERSION} 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 | ||
| # Build dependencies - this is the caching Docker layer! | ||
| RUN cargo chef cook --release --recipe-path recipe.json | ||
| # Build application | ||
| COPY . . | ||
| RUN cargo build --release | ||
|
|
||
| # why we dont use alpine for base image - https://andygrove.io/2020/05/why-musl-extremely-slow/ | ||
| FROM debian:bookworm as runtime | ||
|
|
||
| COPY --from=builder /app/target/release/rustic /usr/local/bin | ||
|
|
||
| # usually container will be used with --rm option | ||
| # so we ignore cache | ||
| ENV RUSTIC_NO_CACHE=true | ||
|
||
|
|
||
| ENTRYPOINT ["/usr/local/bin/rustic"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why you don't use the slim variant here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I will change it with next commit.