Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (37 loc) · 1.56 KB
/
Copy pathDockerfile
File metadata and controls
52 lines (37 loc) · 1.56 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
# Multi-stage build for TrustChain node.
# Build: docker build -t trustchain-node .
# Run: docker run -p 8200:8200/udp -p 8201:8201 -p 8202:8202 -p 8203:8203 trustchain-node
# --- Builder stage ---
FROM rust:1.85-bookworm AS builder
WORKDIR /build
COPY Cargo.toml Cargo.lock ./
COPY trustchain-core/ trustchain-core/
COPY trustchain-transport/ trustchain-transport/
COPY trustchain-node/ trustchain-node/
COPY proto/ proto/
# Install protobuf compiler for tonic-build.
RUN apt-get update && apt-get install -y protobuf-compiler && rm -rf /var/lib/apt/lists/*
RUN cargo build --release --bin trustchain-node
# --- Runtime stage ---
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
RUN useradd -r -s /bin/false -u 1001 trustchain
COPY --from=builder /build/target/release/trustchain-node /usr/local/bin/trustchain-node
# Install default config (paths set to /data for persistent volume).
RUN mkdir -p /etc/trustchain /data && chown trustchain:trustchain /data
COPY deploy/docker-node.toml /etc/trustchain/node.toml
# QUIC (UDP), gRPC (TCP), HTTP REST (TCP).
EXPOSE 8200/udp
EXPOSE 8201/tcp
EXPOSE 8202/tcp
# Transparent HTTP proxy for sidecar mode.
EXPOSE 8203/tcp
# Persistent volume for identity key and SQLite database.
# Mount: docker run -v trustchain-data:/data ...
VOLUME /data
ENV RUST_LOG=info
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD ["curl", "-sf", "http://localhost:8202/healthz"]
USER trustchain
ENTRYPOINT ["trustchain-node"]
CMD ["run", "--config", "/etc/trustchain/node.toml"]