-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (43 loc) · 1.68 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (43 loc) · 1.68 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
# === Build stage ===
FROM rust:1-bookworm AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
protobuf-compiler \
clang \
libclang-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy dependency manifests first to leverage Docker layer caching
COPY Cargo.toml Cargo.lock ./
# Create dummy files to trigger dependency download
RUN mkdir -p src/bin/aether-bench && \
echo "fn main(){}" > src/main.rs && \
echo "fn main(){}" > src/bin/aether-bench/main.rs && \
echo "fn main(){}" > build.rs && \
mkdir benches && \
echo "fn main(){}" > benches/storage.rs && \
echo "fn main(){}" > benches/raft_store.rs && \
echo "fn main(){}" > benches/codec.rs && \
mkdir proto && touch proto/kv.proto proto/cluster.proto proto/raft.proto \
proto/watch.proto proto/lease.proto proto/auth.proto proto/shard.proto \
proto/maintenance.proto proto/lock.proto proto/election.proto \
proto/barrier.proto proto/queue.proto proto/session.proto && \
cargo build --release && \
rm -rf src build.rs benches proto
# Copy source and proto files, then rebuild
COPY build.rs ./
COPY benches/ benches/
COPY proto/ proto/
COPY src/ src/
RUN touch build.rs src/main.rs && cargo build --release
# === Runtime stage ===
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -r aether && useradd -r -g aether -d /data aether
COPY --from=builder /app/target/release/aether /usr/local/bin/aether
RUN mkdir -p /data && chown aether:aether /data
USER aether
WORKDIR /data
EXPOSE 2379 2380 9090
ENTRYPOINT ["aether"]