-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1.62 KB
/
Dockerfile
File metadata and controls
48 lines (35 loc) · 1.62 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
# Build stage
FROM rust:latest AS builder
WORKDIR /build
# Use Docker BuildKit cache mounts for faster builds
RUN --mount=type=bind,source=api,target=/build/api \
--mount=type=bind,source=common,target=/build/common \
--mount=type=bind,source=lite,target=/build/lite \
--mount=type=bind,source=sdk,target=/build/sdk \
--mount=type=bind,source=cli,target=/build/cli \
--mount=type=bind,source=Cargo.toml,target=/build/Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=/build/Cargo.lock \
--mount=type=cache,id=s2-rust,sharing=locked,target=/build/target \
--mount=type=cache,sharing=locked,target=/usr/local/cargo/registry \
--mount=type=cache,sharing=locked,target=/usr/local/cargo/git \
cargo build --locked --release --package s2-cli --bin s2
# Copy the binary from the cache volume
RUN --mount=type=cache,id=s2-rust,sharing=locked,target=/build/target \
mkdir -p /output && \
cp /build/target/release/s2 /output/s2
# Debug runtime - ubuntu with shell access
# Build with: docker build --target debug .
FROM ubuntu:latest AS debug
RUN apt-get update && \
apt-get install -y ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /output/s2 /app/s2
ENTRYPOINT ["./s2"]
# Production runtime (default) - minimal distroless image running as non-root (UID 65532)
FROM gcr.io/distroless/cc-debian13:nonroot AS runtime
LABEL org.opencontainers.image.source="https://github.com/s2-streamstore/s2"
LABEL org.opencontainers.image.documentation="https://github.com/s2-streamstore/s2/releases"
WORKDIR /app
COPY --from=builder /output/s2 /app/s2
ENTRYPOINT ["./s2"]