-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (25 loc) · 1009 Bytes
/
Dockerfile
File metadata and controls
39 lines (25 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM rust:1.89-bookworm AS chef
# COPY rust-toolchain.toml .
RUN cargo install --locked cargo-chef
FROM chef AS planner
WORKDIR /app
COPY --from=chef /usr/local/cargo/ /usr/local/cargo/
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
WORKDIR /app
COPY --from=chef /usr/local/cargo/ /usr/local/cargo/
COPY --from=planner /app/recipe.json recipe.json
RUN echo "recipe.json hash:" && sha256sum recipe.json
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
cargo build --release --bin rpc --bin worker --bin spammer
FROM debian:bookworm-slim
WORKDIR /app
COPY --from=builder /app/target/release/rpc /app/rpc
COPY --from=builder /app/target/release/worker /app/worker
COPY --from=builder /app/target/release/spammer /app/spammer