forked from mandrigin/aggkit-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.miden-node
More file actions
98 lines (82 loc) · 2.77 KB
/
Copy pathDockerfile.miden-node
File metadata and controls
98 lines (82 loc) · 2.77 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Build stage for miden-node
FROM rust:1.82-slim-bookworm AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
libsqlite3-dev \
protobuf-compiler \
git \
cmake \
clang \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Clone miden-node
RUN git clone --depth 1 --branch v0.13.4 \
https://github.com/0xMiden/miden-node.git .
# Save the miden-node commit SHA for labeling
RUN git rev-parse HEAD > /tmp/miden-node-commit.txt && \
echo "Miden-node commit: $(cat /tmp/miden-node-commit.txt)"
# Build the node binary
RUN cargo build --release --bin miden-node
# Runtime stage
FROM debian:bookworm-slim
# Copy the miden-node commit SHA from builder
COPY --from=builder /tmp/miden-node-commit.txt /app/miden-node-commit.txt
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
libsqlite3-0 \
curl \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /build/target/release/miden-node /usr/local/bin/
# Copy genesis config
COPY config/genesis.toml /app/genesis.toml
# Add label with miden-node source info
LABEL org.opencontainers.image.source="https://github.com/0xMiden/miden-node" \
org.opencontainers.image.ref.name="v0.13.4"
# gRPC port
EXPOSE 57291
# Create data and accounts directories
RUN mkdir -p /data /accounts
# Create entrypoint script
RUN printf '%s\n' \
'#!/bin/bash' \
'set -e' \
'' \
'DATA_DIR="${MIDEN_NODE_DATA_DIRECTORY:-/data}"' \
'ACCOUNTS_DIR="${MIDEN_NODE_ACCOUNTS_DIRECTORY:-/accounts}"' \
'RPC_URL="${MIDEN_NODE_RPC_URL:-http://0.0.0.0:57291}"' \
'' \
'# Log miden-node version info' \
'echo "=== Miden Node Startup ==="' \
'if [ -f /app/miden-node-commit.txt ]; then' \
' echo "Miden-node commit: $(cat /app/miden-node-commit.txt)"' \
'fi' \
'' \
'# Bootstrap if data directory is empty (no database yet)' \
'if [ ! -f "$DATA_DIR/miden-store.sqlite3" ]; then' \
' echo "Bootstrapping miden-node..."' \
' miden-node bundled bootstrap \' \
' --genesis-config-file /app/genesis.toml \' \
' --data-directory "$DATA_DIR" \' \
' --accounts-directory "$ACCOUNTS_DIR"' \
' echo "Bootstrap complete."' \
' echo ""' \
' echo "=== Accounts Created at Bootstrap ==="' \
' ls -la "$ACCOUNTS_DIR"' \
' echo "=== End Accounts List ==="' \
' echo ""' \
'fi' \
'' \
'echo "Starting miden-node on $RPC_URL..."' \
'exec miden-node bundled start \' \
' --rpc.url "$RPC_URL" \' \
' --data-directory "$DATA_DIR" \' \
' "$@"' \
> /usr/local/bin/entrypoint.sh && \
chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD []