diff --git a/Dockerfile b/Dockerfile index 8ff5775..c12500b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM ethereum/client-go:v1.11.5 +RUN apk --update add curl COPY content . diff --git a/content/docker-entrypoint.sh b/content/docker-entrypoint.sh index 14f8c3b..2e4937e 100644 --- a/content/docker-entrypoint.sh +++ b/content/docker-entrypoint.sh @@ -17,6 +17,11 @@ fi echo "Starting geth..." +PUBLIC_IP_ARGS="" +if [[ "${NAT_PUBLIC_IP_AUTO}" == "true" ]]; then + PUBLIC_IP_ARGS=--nat=extip:$(curl https://ipinfo.io/ip) +fi + if [ -n "$ENABLE_MINER" ]; then MINER_ARGS="--mine --miner.etherbase 0x10420A3dE36231E12eb601F45b4004311372dcEa" else @@ -26,7 +31,8 @@ fi echo "UNLOCK_ARGS: $UNLOCK_ARGS" echo "MINER_ARGS: $MINER_ARGS" echo "GETH_ARGS: $GETH_ARGS" +echo "PUBLIC_IP_ARGS: $PUBLIC_IP_ARGS" geth init genesis.json -geth --networkid 789988 --http --http.addr 0.0.0.0 --allow-insecure-unlock --http.vhosts '*' $UNLOCK_ARGS $MINER_ARGS $GETH_ARGS +geth --networkid 789988 --http --http.addr 0.0.0.0 --allow-insecure-unlock --http.vhosts '*' $UNLOCK_ARGS $MINER_ARGS $PUBLIC_IP_ARGS $GETH_ARGS exit 0 diff --git a/docker-compose.yaml b/docker-compose.yaml index ab2d94a..0b8e209 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -11,6 +11,7 @@ services: - ENABLE_MINER=1 - UNLOCK_START_INDEX=0 - UNLOCK_NUMBER=1 + - NAT_PUBLIC_IP_AUTO=true geth-for-codex2: build: context: .