-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (32 loc) · 901 Bytes
/
Dockerfile
File metadata and controls
42 lines (32 loc) · 901 Bytes
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
# Stage 1: Build
FROM rust:1.88-slim AS builder
RUN apt-get update && apt-get install -y \
protobuf-compiler \
libprotobuf-dev \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY Cargo.toml Cargo.lock* ./
COPY build.rs ./
COPY proto proto/
COPY src src/
COPY benches benches/
COPY tests tests/
# Cache dependencies
RUN mkdir -p .cargo && \
cargo vendor > /dev/null 2>&1 || true && \
cargo build --release
# Stage 2: Runtime
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/rusd /usr/local/bin/rusd
RUN chmod +x /usr/local/bin/rusd
EXPOSE 2379 2380
HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \
CMD curl -f http://localhost:2379/health || exit 1
ENTRYPOINT ["rusd"]
CMD ["--help"]