Adds support for public-auto-ip to geth image

This commit is contained in:
benbierens 2023-11-15 14:45:07 +01:00
parent 781261cf80
commit 119cc86954
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
3 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,5 @@
FROM ethereum/client-go:v1.11.5
RUN apk --update add curl
COPY content .

View File

@ -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

View File

@ -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: .