Skip to content

Commit

Permalink
Adds support for public-auto-ip to geth image
Browse files Browse the repository at this point in the history
  • Loading branch information
benbierens committed Nov 15, 2023
1 parent 781261c commit 119cc86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ethereum/client-go:v1.11.5
RUN apk --update add curl

COPY content .

Expand Down
8 changes: 7 additions & 1 deletion content/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand Down

0 comments on commit 119cc86

Please sign in to comment.