Skip to content

Commit 6a49a50

Browse files
committed
ci: improve build cache
1 parent bd443c2 commit 6a49a50

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,7 @@ jobs:
3838
push: true
3939
tags: ${{ steps.meta.outputs.tags }}
4040
labels: ${{ steps.meta.outputs.labels }}
41+
cache-from: type=gha
42+
cache-to: type=gha,mode=max
4143

4244

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
FROM rust:1.80-bookworm as builder
2-
1+
# Chef stage - prepares the recipe for dependency caching
2+
FROM rust:1.80-bookworm as chef
3+
RUN cargo install cargo-chef
34
WORKDIR /app
45

6+
FROM chef as planner
57
COPY . .
8+
RUN cargo chef prepare --recipe-path recipe.json
69

10+
FROM chef as builder
11+
COPY --from=planner /app/recipe.json recipe.json
12+
RUN cargo chef cook --release --recipe-path recipe.json
13+
COPY . .
714
RUN cargo build --release
815

9-
FROM rust:1.80-bookworm as runtime
10-
16+
FROM debian:bookworm-slim as runtime
17+
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
18+
WORKDIR /app
1119
COPY --from=builder /app/target/release/pembantu_telegram .
12-
1320
CMD ["./pembantu_telegram"]

0 commit comments

Comments
 (0)