2024-12-30 17:03:52 +00:00
|
|
|
FROM rust:1.83.0-bookworm AS planner
|
|
|
|
RUN cargo install cargo-chef
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the whole project
|
|
|
|
COPY . .
|
|
|
|
# Prepare a build plan ("recipe")
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
|
|
|
|
FROM rust:1.83.0-bookworm AS builder
|
|
|
|
RUN cargo install cargo-chef
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Copy the build plan from the previous Docker stage
|
|
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
|
|
|
|
|
|
# Build dependencies - this layer is cached as long as `recipe.json`
|
|
|
|
# doesn't change.
|
|
|
|
RUN cargo chef cook --recipe-path recipe.json
|
|
|
|
|
|
|
|
# Build the whole project
|
|
|
|
COPY . .
|
|
|
|
RUN cargo build --profile release
|
|
|
|
|
|
|
|
# Run the project
|
2025-01-03 21:03:56 +00:00
|
|
|
FROM debian:bookworm-slim AS runner
|
2024-12-30 17:03:52 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
2025-01-04 16:16:13 +00:00
|
|
|
RUN apt-get update && apt-get -y install libssl3 && apt-get -y install ca-certificates
|
2025-01-03 21:03:56 +00:00
|
|
|
|
2024-12-30 17:03:52 +00:00
|
|
|
COPY --from=builder /app/target/release/bot /app/bot
|
|
|
|
|
|
|
|
ENTRYPOINT ["/app/bot"]
|