-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (47 loc) · 1.61 KB
/
Dockerfile
File metadata and controls
63 lines (47 loc) · 1.61 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
# Build stage
FROM rust:1.75-slim-bullseye as builder
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
pkg-config \
liblmdb-dev \
&& rm -rf /var/lib/apt/lists/*
# Create a new empty shell project
WORKDIR /usr/src/enokiweave
# Copy manifests
COPY Cargo.lock Cargo.toml ./
# Copy source code
COPY src ./src
COPY setup ./setup
# Build for release
RUN cargo build --release
# Runtime stage
FROM debian:bullseye-slim
# Install runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
liblmdb0 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -r enoki && useradd -r -g enoki enoki
# Create necessary directories and set permissions
RUN mkdir -p /var/lib/enokiweave /etc/enokiweave && \
chown -R enoki:enoki /var/lib/enokiweave /etc/enokiweave
# Copy the build artifacts from builder
COPY --from=builder /usr/src/enokiweave/target/release/enokiweave /usr/local/bin/
COPY --from=builder /usr/src/enokiweave/target/release/build-transaction /usr/local/bin/
# Copy configuration files
COPY setup/example_genesis_file.json /etc/enokiweave/genesis.json
COPY setup/example_initial_peers_file.txt /etc/enokiweave/peers.txt
# Set working directory
WORKDIR /var/lib/enokiweave
# Switch to non-root user
USER enoki
# Expose ports
EXPOSE 3001
# Add healthcheck
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3001/health || exit 1
# Set entrypoint
ENTRYPOINT ["enokiweave"]
CMD ["--genesis-file-path", "/etc/enokiweave/genesis.json", "--rpc_port", "3001"]