Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/target
.git
.github
.claude
.idea
.vscode
*.swp
*.swo
.DS_Store
.env
.env.*
tests/
criterion/
55 changes: 55 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,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"]
Loading