Repository navigation
Expand file tree
/
Copy pathDockerfile.linux
More file actions
42 lines (32 loc) · 1.94 KB
/
Copy pathDockerfile.linux
File metadata and controls
42 lines (32 loc) · 1.94 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
# ─── Dockerfile.linux ────────────────────────────────────────────────────────
# Standalone Linux image for manual testing and production deployment (37.5 MB).
# ─────────────────────────────────────────────────────────────────────────────
# ─── Stage 1: Build ──────────────────────────────────────────────────────────
FROM rust:1.97-slim-bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
binutils \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY . .
# Build all release binaries targeting Linux (io_uring engine auto-enabled on Linux)
RUN cargo build --release \
-p kachedb-server \
-p kachedb-cli \
-p kachedb-bench
# Strip debug symbols
RUN strip /build/target/release/kachedb-server \
/build/target/release/kachedb-cli \
/build/target/release/kachedb-bench
# ─── Stage 2: Runtime ─────────────────────────────────────────────────────────
FROM gcr.io/distroless/cc-debian12:nonroot
WORKDIR /data
COPY --from=builder /build/target/release/kachedb-server /usr/local/bin/kachedb-server
COPY --from=builder /build/target/release/kachedb-cli /usr/local/bin/kachedb-cli
COPY --from=builder /build/target/release/kachedb-bench /usr/local/bin/kachedb-bench
COPY --from=builder /build/kachedb.conf /etc/kachedb/kachedb.conf
# KacheDB default port
EXPOSE 6379
ENTRYPOINT ["kachedb-server"]
CMD ["-c", "/etc/kachedb/kachedb.conf"]