-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.prebuilt
More file actions
51 lines (41 loc) · 2.05 KB
/
Copy pathDockerfile.prebuilt
File metadata and controls
51 lines (41 loc) · 2.05 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
# Lightweight Docker image for KalamDB using pre-built binaries
#
# Option 1: Build with local binaries (after `cargo build --release`):
# docker build -f docker/build/Dockerfile.prebuilt -t jamals86/kalamdb:latest .
#
# Option 2: Used in release workflow with pre-compiled binaries:
# docker build --build-context binaries=binaries-amd64 -f docker/build/Dockerfile.prebuilt -t jamals86/kalamdb:latest .
# Runtime image only (no build stage needed)
FROM debian:bookworm-slim
# Install runtime dependencies and create user in single layer
# Note: curl is needed for healthcheck
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
curl \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
useradd -m -u 1000 kalamdb && \
mkdir -p /data/rocksdb /data/storage /data/logs /config && \
chown -R kalamdb:kalamdb /data /config
# Copy pre-built binaries from build context (provided via --build-context binaries=...)
# The build context should contain kalamdb-server and kalam binaries
COPY --from=binaries --chmod=755 kalamdb-server /usr/local/bin/kalamdb-server
COPY --from=binaries --chmod=755 kalam /usr/local/bin/kalam-cli
# Create symlink so 'kalam' command works (docs reference this name)
RUN ln -s /usr/local/bin/kalam-cli /usr/local/bin/kalam
# Copy default server configuration (owned by kalamdb user) and normalize data path
COPY backend/server.example.toml /config/server.toml
RUN sed -i 's|data_path = "\./data"|data_path = "/data"|g' /config/server.toml && \
chown kalamdb:kalamdb /config/server.toml
# Switch to non-root user
USER kalamdb
# Set working directory (server looks for server.toml here)
WORKDIR /data
# Expose default port
EXPOSE 8080
# Health check using curl (more reliable than CLI which needs auth)
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -sf http://localhost:8080/health || exit 1
# Default command: run server (looks for server.toml in current directory)
CMD ["/usr/local/bin/kalamdb-server", "/config/server.toml"]