-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (49 loc) · 1.83 KB
/
Dockerfile
File metadata and controls
64 lines (49 loc) · 1.83 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
52
53
54
55
56
57
58
59
60
61
62
63
64
# ============================================================
# Stage 1: Build
# ============================================================
FROM rust:1.94-slim-bookworm AS builder
ARG TARGETARCH
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
curl \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install protoc (multi-arch)
RUN case "$TARGETARCH" in \
amd64) PROTOC_ARCH="x86_64" ;; \
arm64) PROTOC_ARCH="aarch_64" ;; \
*) PROTOC_ARCH="x86_64" ;; \
esac && \
curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v29.5/protoc-29.5-linux-${PROTOC_ARCH}.zip" && \
unzip "protoc-29.5-linux-${PROTOC_ARCH}.zip" -d /usr/local && \
rm "protoc-29.5-linux-${PROTOC_ARCH}.zip"
WORKDIR /app
# Copy workspace manifests first for layer caching
COPY Cargo.toml Cargo.lock ./
COPY omem-server/ omem-server/
# Build with all features (glibc supports everything including Bedrock)
RUN cargo build --release -p omem-server
# ============================================================
# Stage 2: Runtime
# ============================================================
FROM debian:bookworm-slim
LABEL org.opencontainers.image.source="https://github.com/ourmem/omem"
LABEL org.opencontainers.image.description="ourmem — Shared Memory That Never Forgets"
LABEL org.opencontainers.image.licenses="Apache-2.0"
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -r -s /bin/false -d /data omem \
&& mkdir -p /data && chown omem:omem /data
COPY --from=builder /app/target/release/omem-server /usr/local/bin/
VOLUME ["/data"]
WORKDIR /data
ENV RUST_LOG=info
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s \
CMD curl -f http://localhost:8080/health || exit 1
USER omem
CMD ["omem-server"]