Skip to content

Commit b92db3f

Browse files
MitsuwaMichael de Hoog
andauthored
Dockerfile Cleanups, remove local git repos, git repo sha256 checks, smaller image, fix entrypoint naming (#54)
* Remove sh from file names as there is there is already an interpreter, also you dont need to have sh entrypoint with the interpreter * Cleanup apt lists, only copy the necessary files to run geth * remove all the excessive git commands * add sha256 checksum on the repo tarballs * Use dockerfile:1-labs ADD --checksum option to do checksum verification * Reintroduce "sh" prefix for windows compatibility --------- Co-authored-by: Michael de Hoog <michael.dehoog@coinbase.com>
1 parent 68018f7 commit b92db3f

5 files changed

Lines changed: 19 additions & 19 deletions

File tree

Dockerfile

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1+
# syntax=docker/dockerfile:1-labs
12
FROM golang:1.19 as op
23

34
WORKDIR /app
45

5-
ENV REPO=https://github.com/ethereum-optimism/optimism.git
6+
ENV REPO=https://github.com/ethereum-optimism/optimism
67
ENV COMMIT=09d23ee8995b7c318a4469a49276f9453535c6a9
7-
RUN git init && \
8-
git remote add origin $REPO && \
9-
git fetch --depth=1 origin $COMMIT && \
10-
git reset --hard FETCH_HEAD
8+
ENV CHECKSUM=593338d48967154182d07920fcaf51d18e8c6adb64485356b059e1a1f82fe941
9+
ADD --checksum=sha256:$CHECKSUM $REPO/archive/$COMMIT.tar.gz ./
1110

12-
RUN cd op-node && \
11+
RUN tar -xvf ./$COMMIT.tar.gz --strip-components=1 && \
12+
cd op-node && \
1313
make op-node
1414

15-
1615
FROM golang:1.19 as geth
1716

1817
WORKDIR /app
1918

20-
ENV REPO=https://github.com/ethereum-optimism/op-geth.git
19+
ENV REPO=https://github.com/ethereum-optimism/op-geth
2120
ENV COMMIT=a84992a3b7c33f038ccc69e761bafeefcd605fd3
22-
RUN git init && \
23-
git remote add origin $REPO && \
24-
git fetch --depth=1 origin $COMMIT && \
25-
git reset --hard FETCH_HEAD
26-
27-
RUN go run build/ci.go install -static ./cmd/geth
21+
ENV CHECKSUM=8d97c1292c67afb08c124fc1f6586f92ec127464e04749b80eed709de145df17
22+
ADD --checksum=sha256:$CHECKSUM $REPO/archive/$COMMIT.tar.gz ./
2823

24+
RUN tar -xvf ./$COMMIT.tar.gz --strip-components=1 && \
25+
go run build/ci.go install -static ./cmd/geth
2926

3027
FROM golang:1.19
3128

3229
RUN apt-get update && \
33-
apt-get install -y jq curl
30+
apt-get install -y jq curl && \
31+
rm -rf /var/lib/apt/lists
3432

3533
WORKDIR /app
3634

3735
COPY --from=op /app/op-node/bin/op-node ./
3836
COPY --from=geth /app/build/bin/geth ./
39-
COPY . .
37+
COPY geth-entrypoint .
38+
COPY op-node-entrypoint .
39+
COPY goerli ./goerli

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ curl -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["late
6363
-H "Content-Type: application/json" http://localhost:8545
6464
```
6565

66-
Note: Some L1 nodes (e.g. Erigon) do not support fetching storage proofs. You can work around this by specifying `--l1.trustrpc` when starting op-node (add it in `op-node-entrypoint.sh` and rebuild the docker image with `docker compose build`.) Do not do this unless you fully trust the L1 node provider.
66+
Note: Some L1 nodes (e.g. Erigon) do not support fetching storage proofs. You can work around this by specifying `--l1.trustrpc` when starting op-node (add it in `op-node-entrypoint` and rebuild the docker image with `docker compose build`.) Do not do this unless you fully trust the L1 node provider.
6767

6868
You can map a local data directory for `op-geth` by adding a volume mapping to the `docker-compose.yaml`:
6969

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
- 8545:8545
66
- 8546:8546
77
- 30303:30303
8-
command: [ "sh", "./geth-entrypoint.sh" ]
8+
command: [ "sh", "./geth-entrypoint" ]
99
environment:
1010
- OP_GETH_GENESIS_FILE_PATH=goerli/genesis-l2.json
1111
- OP_GETH_SEQUENCER_HTTP=https://goerli.base.org
@@ -21,7 +21,7 @@ services:
2121
- 9222:9222
2222
- 7300:7300 # metrics
2323
- 6060:6060
24-
command: [ "sh", "./op-node-entrypoint.sh" ]
24+
command: [ "sh", "./op-node-entrypoint" ]
2525
environment:
2626
- OP_NODE_L1_ETH_RPC=https://ethereum-goerli-rpc.allthatnode.com # [recommended] replace with your preferred L1 (ethereum, not Base) node RPC URL
2727
- OP_NODE_L2_ENGINE_AUTH=/tmp/engine-auth-jwt
File renamed without changes.

0 commit comments

Comments
 (0)