-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (28 loc) · 1.51 KB
/
Dockerfile
File metadata and controls
45 lines (28 loc) · 1.51 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
34
35
36
37
38
39
40
41
42
43
44
45
# ── Stage 1: chef — generate dependency recipe ──────────────────────────────
FROM rust:1.93-slim AS chef
RUN cargo install cargo-chef --locked
WORKDIR /build
# ── Stage 2: planner — capture dependency graph ─────────────────────────────
FROM chef AS planner
COPY Cargo.toml Cargo.lock ./
COPY crates/ crates/
RUN cargo chef prepare --recipe-path recipe.json
# ── Stage 3: builder — cached dependency build + final compile ──────────────
FROM chef AS builder
COPY --from=planner /build/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json -p trogon-source-github
COPY Cargo.toml Cargo.lock ./
COPY crates/ crates/
RUN cargo build --release -p trogon-source-github && \
strip target/release/trogon-source-github
# ── Stage 4: runtime ────────────────────────────────────────────────────────
FROM debian:bookworm-20250317-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN useradd --no-create-home --shell /usr/sbin/nologin trogon
COPY --from=builder /build/target/release/trogon-source-github /usr/local/bin/trogon-source-github
USER trogon
EXPOSE 8080
STOPSIGNAL SIGTERM
ENTRYPOINT ["/usr/local/bin/trogon-source-github"]