diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000000..e2bcdbe5ca51 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,12 @@ +# Requires the root repo dir to be mounted at /mnt/go-ethereum in order to run this! +FROM golang:1.14-alpine + +RUN apk add --no-cache make gcc musl-dev linux-headers git +RUN apk add --no-cache ca-certificates + +EXPOSE 8545 8546 8547 30303 30303/udp + +# Used to mount the code so image isn't re-built every time code changes +WORKDIR /mnt/go-ethereum + +ENTRYPOINT ["sh", "./docker/dev_entrypoint.sh"] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 000000000000..4420c5242f9d --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,24 @@ +version: "3" + +services: + geth_l2: + build: + context: . + dockerfile: Dockerfile.dev + volumes: + - l2-node-data:/mnt/l2-node/l2:rw + - ./:/mnt/go-ethereum/ + + environment: + - REBUILD= # Set this if you want to rebuild on startup, leave unset otherwise + - CLEAR_DATA_KEY + - TARGET_GAS_LIMIT + - VOLUME_PATH=/mnt/l2-node/l2 + - HOSTNAME=geth_l2 + - PORT=8545 + - NETWORK_ID=108 + ports: + - 8545:8545 + +volumes: + l2-node-data: \ No newline at end of file diff --git a/docker/dev_entrypoint.sh b/docker/dev_entrypoint.sh new file mode 100755 index 000000000000..25c5b8767dd6 --- /dev/null +++ b/docker/dev_entrypoint.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# Exits if any command fails +set -e + +if [ -n "$REBUILD" ]; then + echo -e "\n\nREBUILD env var set, rebuilding...\n\n" + + make geth + echo -e "\n\nCode built proceeding with ./entrypoint.sh...\n\n" +else + echo -e "\n\nREBUILD env var not set, calling ./entrypoint.sh without building...\n\n" +fi + +echo "Starting Geth..." +## Command to kick off geth +TARGET_GAS_LIMIT=${TARGET_GAS_LIMIT:-4294967295} +./build/bin/geth --dev \ + --datadir $VOLUME_PATH \ + --rpc \ + --rpcaddr $HOSTNAME \ + --rpcvhosts='*' \ + --rpcport $PORT \ + --networkid $NETWORK_ID \ + --rpcapi 'eth,net' \ + --gasprice '0' \ + --targetgaslimit $TARGET_GAS_LIMIT \ + --nousb \ + --gcmode=archive \ + --verbosity "6" \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh old mode 100644 new mode 100755 index c719ced40122..6f87a4164fe2 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -18,4 +18,16 @@ fi echo "Starting Geth..." ## Command to kick off geth -geth --dev --datadir $VOLUME_PATH --rpc --rpcaddr $HOSTNAME --rpcvhosts=* --rpcport $PORT --networkid $NETWORK_ID --rpcapi 'eth,net' --gasprice '0' --targetgaslimit $TARGET_GAS_LIMIT --nousb --gcmode=archive --verbosity "6" +geth --dev \ + --datadir $VOLUME_PATH \ + --rpc \ + --rpcaddr $HOSTNAME \ + --rpcvhosts='*' \ + --rpcport $PORT \ + --networkid $NETWORK_ID \ + --rpcapi 'eth,net' \ + --gasprice '0' \ + --targetgaslimit $TARGET_GAS_LIMIT \ + --nousb \ + --gcmode=archive \ + --verbosity "6" \ No newline at end of file diff --git a/docker/test_entrypoint.sh b/docker/test_entrypoint.sh old mode 100644 new mode 100755