update the dockerfile to build the node (#366)

This commit is contained in:
0g-peterzhb 2025-04-30 14:50:18 +08:00 committed by GitHub
parent 347cd3e4f3
commit 229523ceec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 35 additions and 11 deletions

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
# ---------- Dockerfile ----------
FROM rust
# 0) Install build deps (same as you had)
RUN apt-get update && \
apt-get install -y clang cmake build-essential pkg-config libssl-dev
# 1) Copy sources and build the binary
WORKDIR /app
COPY . .
RUN cargo build --release
# 2) Keep the binary on $PATH (optional convenience)
RUN install -Dm755 target/release/zgs_node /usr/local/bin/zgs_node
# 3) Persist chain data
VOLUME ["/data"]
###############################################################################
# 4) Runtime flags grab everything from env vars that youll pass with
# `docker run -e …`. Shell-form CMD lets us interpolate ${…} at start-time.
###############################################################################
CMD zgs_node \
--config run/config-testnet-turbo.toml \
--log-config-file run/log_config \
--miner-key "${STORAGE_MINER_PRIVATE_KEY:?missing STORAGE_MINER_PRIVATE_KEY}" \
--blockchain-rpc-endpoint "${STORAGE_BLOCKCHAIN_RPC_ENDPOINT:?missing STORAGE_BLOCKCHAIN_RPC_ENDPOINT}" \
--network-enr-address "${STORAGE_ENR_ADDRESS:?missing STORAGE_ENR_ADDRESS}" \
--db-max-num-chunks "${STORAGE_DB_MAX_NUM_SECTORS:-8000000000}"

View File

@ -1,6 +0,0 @@
FROM rust
VOLUME ["/data"]
COPY . .
RUN apt-get update && apt-get install -y clang cmake build-essential pkg-config libssl-dev
RUN cargo build --release
CMD ["./target/release/zgs_node", "--config", "run/config-testnet-turbo.toml", "--log", "run/log_config"]

View File

@ -9,6 +9,7 @@ pub fn cli_app() -> Command {
arg!(--"blockchain-rpc-endpoint" [URL] "Sets blockchain RPC endpoint (Default: http://127.0.0.1:8545)")
)
.arg(arg!(--"db-max-num-chunks" [NUM] "Sets the max number of chunks to store in db (Default: None)"))
.arg(arg!(--"network-enr-address" [URL] "Sets the network ENR address (Default: None)"))
.allow_external_subcommands(true)
.version(zgs_version::VERSION)
}

View File

@ -33,7 +33,7 @@
# List of nodes to bootstrap UDP discovery. Note, `network_enr_address` should be
# configured as well to enable UDP discovery.
network_boot_nodes = ["/ip4/47.251.117.133/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJxQWu3i1FL1aFYeh9wiQTNu4pDCgps","/ip4/47.76.61.226/udp/1234/p2p/16Uiu2HAm2k6ua2mGgvZ8rTMV8GhpW71aVzkQWy7D37TTDuLCpgmX"]
network_boot_nodes = ["/ip4/47.251.79.83/udp/1234/p2p/16Uiu2HAkvJYQABP1MdvfWfUZUzGLx1sBSDZ2AT92EFKcMCCPVawV", "/ip4/47.238.87.44/udp/1234/p2p/16Uiu2HAmFGsLoajQdEds6tJqsLX7Dg8bYd2HWR4SbpJUut4QXqCj", "/ip4/47.251.78.104/udp/1234/p2p/16Uiu2HAmSe9UWdHrqkn2mKh99b9DwYZZcea6krfidtU3e5tiHiwN", "/ip4/47.76.30.235/udp/1234/p2p/16Uiu2HAm5tCqwGtXJemZqBhJ9JoQxdDgkWYavfCziaqaAYkGDSfU"]
# List of libp2p nodes to initially connect to.
# network_libp2p_nodes = []
@ -80,11 +80,11 @@ network_boot_nodes = ["/ip4/47.251.117.133/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJ
# blockchain_rpc_endpoint = "http://127.0.0.1:8545"
# Flow contract address to sync event logs.
log_contract_address = "0xbD2C3F0E65eDF5582141C35969d66e34629cC768"
log_contract_address = "0x56A565685C9992BF5ACafb940ff68922980DBBC5"
# Block number to sync event logs from blockchain. Generally, this is
# the block number when flow contract deployed.
log_sync_start_block_number = 595059
log_sync_start_block_number = 1
# Number of blocks to confirm a transaction.
# confirmation_block_count = 3
@ -158,7 +158,7 @@ log_sync_start_block_number = 595059
#######################################################################
# Mine contract address for incentive.
mine_contract_address = "0x6815F41019255e00D6F34aAB8397a6Af5b6D806f"
mine_contract_address = "0xB87E0e5657C25b4e132CB6c34134C0cB8A962AD6"
# Miner key is used to sign blockchain transaction for incentive.
# The value should be a hex string of length 64 without 0x prefix.
@ -194,7 +194,7 @@ db_max_num_sectors = 4000000000
# This only applies if there is no stored shard config in db.
# shard_position = "0/2"
reward_contract_address = "0x51998C4d486F406a788B766d93510980ae1f9360"
reward_contract_address = "0x233B2768332e4Bae542824c93cc5c8ad5d44517E"
# The time interval to check if we should half `shard_position` to prune data.
#
# prune_check_time_s = 60