-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.cli
More file actions
36 lines (28 loc) · 1.11 KB
/
Dockerfile.cli
File metadata and controls
36 lines (28 loc) · 1.11 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
# =============================================================================
# CLI-only container for batch data generation
# =============================================================================
# Stage 1: Chef
FROM rust:1.88-bookworm AS chef
RUN cargo install cargo-chef --locked
WORKDIR /app
# Stage 2: Planner
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# Stage 3: Builder
FROM chef AS builder
RUN apt-get update && apt-get install -y protobuf-compiler libfontconfig1-dev && rm -rf /var/lib/apt/lists/*
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release -p datasynth-cli
# Stage shared libs to a well-known path for the final image
RUN mkdir -p /staging/lib && \
ARCH=$(uname -m) && \
cp /usr/lib/${ARCH}-linux-gnu/liblzma.so.5* /staging/lib/
# Stage 4: Runtime
FROM gcr.io/distroless/cc-debian12
COPY --from=builder /app/target/release/datasynth-data /usr/local/bin/datasynth-data
COPY --from=builder /staging/lib/ /usr/lib/
USER nonroot:nonroot
ENTRYPOINT ["datasynth-data"]