-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (38 loc) · 1.41 KB
/
Dockerfile
File metadata and controls
51 lines (38 loc) · 1.41 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
46
47
48
49
50
51
# ============================================================
# Stage 1 — Builder
# ============================================================
FROM rust:slim-bookworm AS builder
# BIN selects which workspace binary to build (forge | forge-api)
ARG BIN=forge
# System deps needed to compile (openssl for reqwest, pkg-config)
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Copy the whole workspace
COPY . .
# Build the selected binary in release mode
RUN cargo build --release -p ${BIN}
# ============================================================
# Stage 2 — Runtime (minimal)
# ============================================================
FROM debian:bookworm-slim AS runtime
ARG BIN=forge
# Runtime deps: ca-certificates (for HTTPS), libssl (for reqwest TLS)
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
git \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m -u 1000 forge
# Copy the compiled binary
COPY --from=builder /build/target/release/${BIN} /usr/local/bin/${BIN}
# Trajectories will be written here — mount a volume over it
RUN mkdir -p /trajectories && chown forge:forge /trajectories
USER forge
WORKDIR /home/forge
ENV BIN=${BIN}
ENTRYPOINT ["/bin/sh", "-c", "exec /usr/local/bin/$BIN \"$@\"", "--"]
CMD ["--help"]