Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
ci: add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowballXueQiu committed Jan 23, 2024
1 parent 380d9ba commit 2afeaa1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Dockerfile
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"]

0 comments on commit 2afeaa1

Please sign in to comment.