-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (33 loc) · 1.25 KB
/
Dockerfile
File metadata and controls
38 lines (33 loc) · 1.25 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
# syntax=docker/dockerfile:1
FROM lukemathwalker/cargo-chef:latest-rust-1.92.0-bookworm AS chef
WORKDIR /app
ENV CARGO_INCREMENTAL=0
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json \
--package api --package daemon --package dynode
COPY . .
RUN cargo build --release --package api --package daemon --package dynode && cp target/release/api target/release/daemon target/release/dynode /app/
# Shared runtime base
FROM debian:bookworm-slim AS runtime-base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends openssl ca-certificates && rm -rf /var/lib/apt/lists/*
# Core runtime image
FROM runtime-base AS core
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/api /app/
COPY --from=builder /app/daemon /app/
COPY --from=builder /app/Settings.yaml /app/
CMD ["sh", "-c", "/app/${BINARY}"]
# Dynode runtime image
FROM runtime-base AS dynode
WORKDIR /app
COPY --from=builder /app/dynode /app/
COPY --from=builder /app/apps/dynode/config.yml /app/
CMD ["/app/dynode"]