This repository has been archived by the owner on Aug 14, 2024. It is now read-only.
-
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
1 parent
380d9ba
commit 2afeaa1
Showing
1 changed file
with
33 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# cargo-chef and the Rust toolchain | ||
FROM lukemathwalker/cargo-chef AS chef | ||
WORKDIR /app | ||
|
||
# prepare recipe | ||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
# build artifact | ||
FROM chef AS builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
## build dependencies | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
## build application | ||
COPY . . | ||
RUN cargo build --release | ||
|
||
# build slim image | ||
FROM debian:bookworm-slim AS runtime | ||
WORKDIR /app | ||
COPY --from=builder /app/target/release/toyou-cleanup /home/toyou-cleanup | ||
|
||
RUN \ | ||
apt-get update && \ | ||
apt-get install -y curl vim openssl | ||
|
||
RUN \ | ||
apt-get clean && \ | ||
apt-get autoclean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
CMD ["/home/toyou-cleanup"] |