Skip to content

Commit

Permalink
add docker-compose and modify entrypoint for dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvelFisher authored and FletcherMan committed May 8, 2023
1 parent 6cb5dfe commit bfb092d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 13 deletions.
19 changes: 6 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Support setting various labels on the final image
ARG COMMIT=""
ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.18-alpine as builder

Expand All @@ -14,15 +9,13 @@ RUN apk add --no-cache gcc musl-dev linux-headers git ca-certificates \

# Pull Geth into a second stage deploy alpine container
FROM alpine:latest

RUN apk add --no-cache jq
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
COPY entrypoint.sh /entrypoint.sh

VOLUME ["/db"]

EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["geth"]
ENTRYPOINT ["/bin/sh", "/entrypoint.sh"]

# Add some metadata labels to help programatic image consumption
ARG COMMIT=""
ARG VERSION=""
ARG BUILDNUM=""
EXPOSE 8545 8546 8551 30303 30303/udp

LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.4'

volumes:
l2_data:


services:
morph-geth:
build:
context: .
dockerfile: Dockerfile
ports:
- "8545:8545"
- "8546:8546"
- "8551:8551"
- "30303:30303"
volumes:
- "${PWD}/db:/db"
- "${PWD}/build/jwt-secret.txt:/config/jwt-secret.txt"
- "${PWD}/genesis_l2.json:/genesis.json"
entrypoint: # pass the L2 specific flags by overriding the entry-point and adding extra arguments
- "/bin/sh"
- "/entrypoint.sh"
- "--authrpc.jwtsecret=/config/test-jwt-secret.txt"

29 changes: 29 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
GETH_DATA_DIR=/db
GETH_CHAINDATA_DIR="$GETH_DATA_DIR/geth"
GENESIS_FILE_PATH="${GENESIS_FILE_PATH:-/genesis.json}"


if [[ ! -e "$GETH_CHAINDATA_DIR" ]]; then
echo "$GETH_CHAINDATA_DIR missing, running init"
echo "Initializing genesis."
geth --verbosity=3 init --datadir="$GETH_DATA_DIR" "$GENESIS_FILE_PATH"
else
echo "$GETH_KEYSTORE_DIR exists."
fi


geth \
--datadir="$GETH_DATA_DIR" \
--verbosity=3 \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.port=8545 \
--http.api=web3,debug,eth,txpool,net,scroll,engine \
--networkid=53077 \
--authrpc.addr="0.0.0.0" \
--authrpc.port="8551" \
--authrpc.vhosts="*" \
--authrpc.jwtsecret=/config/jwt-secret.txt \
--gcmode=archive

0 comments on commit bfb092d

Please sign in to comment.