From b7c2cffb13706024a485c5a7667a0d6bf9c9ebac Mon Sep 17 00:00:00 2001 From: Sebastian <379651+czarly@users.noreply.github.com> Date: Sun, 22 Oct 2023 09:52:25 +0200 Subject: [PATCH] missing files --- base/Dockerfile-erigon | 31 +++++++++++++++++++++++++++ base/erigon-entrypoint | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 base/Dockerfile-erigon create mode 100644 base/erigon-entrypoint diff --git a/base/Dockerfile-erigon b/base/Dockerfile-erigon new file mode 100644 index 00000000..63671b62 --- /dev/null +++ b/base/Dockerfile-erigon @@ -0,0 +1,31 @@ +FROM golang:1.19 as op + +RUN apk add --no-cache make g++ gcc musl-dev linux-headers git +ARG ERIGON_VERSION=v2.48.1 +ARG ERIGON_REPOSITORY=https://github.com/ledgerwatch/erigon.git + +RUN git clone --recurse-submodules -j8 $ERIGON_REPOSITORY + +WORKDIR ./erigon + +RUN git checkout ${ERIGON_VERSION} + +RUN make erigon + + +FROM golang:1.19 + +RUN apt-get update && \ + apt-get install -y jq curl && \ + rm -rf /var/lib/apt/lists + + +WORKDIR /app + +COPY --from=op /app/op-node/bin/op-node ./ +COPY --from=op-erigon /go/erigon/build/bin/erigon ./ + +COPY erigon-entrypoint . +COPY op-node-entrypoint . +COPY goerli ./goerli +COPY mainnet ./mainnet \ No newline at end of file diff --git a/base/erigon-entrypoint b/base/erigon-entrypoint new file mode 100644 index 00000000..e1bc3843 --- /dev/null +++ b/base/erigon-entrypoint @@ -0,0 +1,48 @@ +#!/bin/sh + +# exit script on any error +set -e + +ERIGON_HOME=/root/.local/share/erigon +OP_GETH_GENESIS_FILE_PATH="${OP_GETH_GENESIS_FILE_PATH:-/genesis.json}" +CHAIN_ID=$(jq -r .config.chainId < "$OP_GETH_GENESIS_FILE_PATH") +RPC_PORT="${RPC_PORT:-8545}" +WS_PORT="${WS_PORT:-8546}" +AUTHRPC_PORT="${AUTHRPC_PORT:-8551}" +METRICS_PORT="${METRICS_PORT:-6060}" +HOST_IP="0.0.0.0" +P2P_PORT="${P2P_PORT:-30303}" + + +if [ ! -f "${ERIGON_HOME}/bootstrapped" ]; +then + echo "write the custom genesis block" + mkdir -p ${ERIGON_HOME:-/root/.local/share/erigon} + erigon init --datadir ${ERIGON_HOME:-/root/.local/share/erigon} $OP_GETH_GENESIS_FILE_PATH +fi + +echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH" + +exec erigon \ + --private.api.addr=localhost:9090 \ + --port=$P2P_PORT + --http.api=eth,debug,net,trace,web3,erigon \ + --http.addr=0.0.0.0 \ + --http.port=8545 \ + --http.corsdomain="*" \ + --http.vhosts="*" \ + --authrpc.addr=0.0.0.0 \ + --authrpc.port=8551 \ + --authrpc.vhosts="*" \ + --authrpc.jwtsecret=${OP_NODE_L2_ENGINE_AUTH} + --rollup.sequencerhttp="$OP_GETH_SEQUENCER_HTTP" + --rollup.historicalrpc="http://optimism-l2geth:8545" + --chain=optimism-mainnet + --networkid=$CHAIN_ID + --ws + --ws.port=8545 + --nodiscover + volumes: + - erigon-optimism-bedrock:/root/.local/share/erigon + - .jwtsecret:/jwtsecret +