Create local development Dockerfile and docker-compose (#17)
Adding docker-compose.dev.yml and Dockerfile.dev to mount the current dir and call a script to conditionally build for fast iteration
This commit is contained in:
parent
47da34c139
commit
7cc1988962
12
Dockerfile.dev
Normal file
12
Dockerfile.dev
Normal file
@ -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"]
|
24
docker-compose.dev.yml
Normal file
24
docker-compose.dev.yml
Normal file
@ -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:
|
30
docker/dev_entrypoint.sh
Executable file
30
docker/dev_entrypoint.sh
Executable file
@ -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"
|
14
docker/entrypoint.sh
Normal file → Executable file
14
docker/entrypoint.sh
Normal file → Executable file
@ -18,4 +18,16 @@ fi
|
|||||||
|
|
||||||
echo "Starting Geth..."
|
echo "Starting Geth..."
|
||||||
## Command to kick off 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"
|
0
docker/test_entrypoint.sh
Normal file → Executable file
0
docker/test_entrypoint.sh
Normal file → Executable file
Loading…
Reference in New Issue
Block a user