mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-11-03 08:07:27 +00:00
multi-stage build dockerfile
This commit is contained in:
parent
3de0dc5ba3
commit
53571f34b7
18
Dockerfile
18
Dockerfile
@ -1,5 +1,5 @@
|
|||||||
# ---------- Dockerfile ----------
|
# ---------- Dockerfile ----------
|
||||||
FROM rust
|
FROM rust AS builder
|
||||||
|
|
||||||
# 0) Install build deps (same as you had)
|
# 0) Install build deps (same as you had)
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
@ -13,11 +13,22 @@ RUN cargo build --release
|
|||||||
# 2) Keep the binary on $PATH (optional convenience)
|
# 2) Keep the binary on $PATH (optional convenience)
|
||||||
RUN install -Dm755 target/release/zgs_node /usr/local/bin/zgs_node
|
RUN install -Dm755 target/release/zgs_node /usr/local/bin/zgs_node
|
||||||
|
|
||||||
# 3) Persist chain data
|
|
||||||
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
|
# 3) Install required runtime libs
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y libssl3 ca-certificates && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 4) Copy binary from builder
|
||||||
|
COPY --from=builder /usr/local/bin/zgs_node /usr/local/bin/zgs_node
|
||||||
|
|
||||||
|
# 5) Persist chain data
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# 4) Runtime flags – grab everything from env vars that you’ll pass with
|
# 6) Runtime flags – grab everything from env vars that you’ll pass with
|
||||||
# `docker run -e …`. Shell-form CMD lets us interpolate ${…} at start-time.
|
# `docker run -e …`. Shell-form CMD lets us interpolate ${…} at start-time.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
CMD zgs_node \
|
CMD zgs_node \
|
||||||
@ -27,3 +38,4 @@ CMD zgs_node \
|
|||||||
--blockchain-rpc-endpoint "${STORAGE_BLOCKCHAIN_RPC_ENDPOINT:?missing STORAGE_BLOCKCHAIN_RPC_ENDPOINT}" \
|
--blockchain-rpc-endpoint "${STORAGE_BLOCKCHAIN_RPC_ENDPOINT:?missing STORAGE_BLOCKCHAIN_RPC_ENDPOINT}" \
|
||||||
--network-enr-address "${STORAGE_ENR_ADDRESS:?missing STORAGE_ENR_ADDRESS}" \
|
--network-enr-address "${STORAGE_ENR_ADDRESS:?missing STORAGE_ENR_ADDRESS}" \
|
||||||
--db-max-num-chunks "${STORAGE_DB_MAX_NUM_SECTORS:-8000000000}"
|
--db-max-num-chunks "${STORAGE_DB_MAX_NUM_SECTORS:-8000000000}"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user