-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (28 loc) · 1.33 KB
/
Dockerfile
File metadata and controls
33 lines (28 loc) · 1.33 KB
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
# syntax=docker/dockerfile:1
# ── Planner (generate dependency recipe) ─────────────────────────────
FROM rust:1.92-slim-bookworm AS planner
RUN cargo install cargo-chef
WORKDIR /app
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# ── Builder (cook deps, then build app) ──────────────────────────────
FROM rust:1.92-slim-bookworm AS builder
RUN apt-get update \
&& apt-get install -y pkg-config libssl-dev \
&& rm -rf /var/lib/apt/lists/* \
&& cargo install cargo-chef
ENV SQLX_OFFLINE=true
WORKDIR /app
# Cook dependencies (cached unless Cargo.toml/Cargo.lock change)
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
RUN cargo build --release -p listener_core
# ── Runtime ──────────────────────────────────────────────────────────
FROM gcr.io/distroless/cc-debian12:nonroot
COPY --from=builder /app/target/release/listener_core /app/listener_core
COPY --from=builder /app/crates/listener_core/migrations/ /app/migrations/
WORKDIR /app
ENTRYPOINT ["/app/listener_core"]
CMD ["--config", "/config.yaml"]