Skip to content

Commit c5bea12

Browse files
IA1.2.4 Generate dockers for the l1, dev node, OP Geth, and OP node services (#182)
* Fix services except the nonce * Simpify manual work * Save fixes WIP * Revert dockerfile change * Save parameter fixes * Add fixes * All services running again. * Fix timestamp and increase dev period * Install pnpm with nix. * More cleanups * Revert go.mod, fix install syntax, add const env, add more comments * Add env file * Fix after merge * Add changes for l1 terraform * Update for op-geth * Fix op node related docker * Add SHA check * Add a TODO * Add jwt back * Create GH actions workflow * Fix tag * Fix path and tag * Add init scripts * Fix paths and settings after adding init scripts * Fix path for CI workflow * Move files * Reorder commands * Fix path * More path update --------- Co-authored-by: Philippe Camacho <[email protected]>
1 parent 6c77551 commit c5bea12

File tree

13 files changed

+434
-77
lines changed

13 files changed

+434
-77
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches: [main, celo*]
6+
paths:
7+
- 'espresso/docker/**'
8+
- 'espresso/docker-compose.yml'
9+
- 'config/**'
10+
pull_request:
11+
paths:
12+
- 'espresso/docker/**'
13+
- 'espresso/docker-compose.yml'
14+
- 'config/**'
15+
workflow_dispatch:
16+
17+
env:
18+
REGISTRY: ghcr.io
19+
IMAGE_PREFIX: ghcr.io/${{ github.repository }}
20+
21+
jobs:
22+
build-l1-geth:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Login to GitHub Container Registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Extract metadata
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.IMAGE_PREFIX }}/l1-geth
43+
tags: |
44+
type=ref,event=branch
45+
type=ref,event=pr
46+
type=sha,prefix={{branch}}-,enable={{is_default_branch}}
47+
type=raw,value=latest,enable={{is_default_branch}}
48+
type=raw,value=pr-${{ github.event.number }},enable=${{ github.event_name == 'pull_request' }}
49+
50+
- name: Build and push L1 Geth
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: espresso/docker/l1-geth
54+
file: espresso/docker/l1-geth/Dockerfile
55+
platforms: linux/amd64
56+
push: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
60+
build-op-geth:
61+
runs-on: ubuntu-latest
62+
permissions:
63+
contents: read
64+
packages: write
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v4
68+
69+
- name: Login to GitHub Container Registry
70+
uses: docker/login-action@v3
71+
with:
72+
registry: ${{ env.REGISTRY }}
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Extract metadata
77+
id: meta
78+
uses: docker/metadata-action@v5
79+
with:
80+
images: ${{ env.IMAGE_PREFIX }}/op-geth
81+
tags: |
82+
type=ref,event=branch
83+
type=ref,event=pr
84+
type=sha,prefix={{branch}}-,enable={{is_default_branch}}
85+
type=raw,value=latest,enable={{is_default_branch}}
86+
type=raw,value=pr-${{ github.event.number }},enable=${{ github.event_name == 'pull_request' }}
87+
88+
- name: Build and push OP Geth
89+
uses: docker/build-push-action@v5
90+
with:
91+
context: espresso/docker/op-geth
92+
file: espresso/docker/op-geth/Dockerfile
93+
platforms: linux/amd64
94+
push: true
95+
tags: ${{ steps.meta.outputs.tags }}
96+
labels: ${{ steps.meta.outputs.labels }}
97+
98+
build-op-node:
99+
runs-on: ubuntu-latest
100+
permissions:
101+
contents: read
102+
packages: write
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v4
106+
107+
- name: Login to GitHub Container Registry
108+
uses: docker/login-action@v3
109+
with:
110+
registry: ${{ env.REGISTRY }}
111+
username: ${{ github.actor }}
112+
password: ${{ secrets.GITHUB_TOKEN }}
113+
114+
- name: Extract metadata
115+
id: meta
116+
uses: docker/metadata-action@v5
117+
with:
118+
images: ${{ env.IMAGE_PREFIX }}/op-node
119+
tags: |
120+
type=ref,event=branch
121+
type=ref,event=pr
122+
type=sha,prefix={{branch}}-,enable={{is_default_branch}}
123+
type=raw,value=latest,enable={{is_default_branch}}
124+
type=raw,value=pr-${{ github.event.number }},enable=${{ github.event_name == 'pull_request' }}
125+
126+
- name: Build and push OP Node
127+
uses: docker/build-push-action@v5
128+
with:
129+
context: .
130+
file: espresso/docker/op-stack/Dockerfile
131+
target: op-node-target
132+
platforms: linux/amd64
133+
push: true
134+
tags: ${{ steps.meta.outputs.tags }}
135+
labels: ${{ steps.meta.outputs.labels }}
136+
build-args: |
137+
TARGET_BASE_IMAGE=ubuntu:22.04
138+
TARGETOS=linux
139+
TARGETARCH=amd64

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,5 @@ gha-creds-*.json
6363
# Ignore generated credentials from google-github-actions/auth
6464
gha-creds-*.json
6565

66-
# Ignore the JWT secret for devnet.
67-
config/jwt.txt
68-
69-
7066
# Ignore keys
7167
*.pem

espresso/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Environment variables for internal devnet.
22

33
ESPRESSO_L1_PORT=8545
4-
ESPRESSO_L1_PROVIDER=http://l1:8545
4+
ESPRESSO_L1_PROVIDER=http://l1-geth:8545
55

66
ESPRESSO_ROLLUP_PORT=9545
77
ESPRESSO_ROLLUP_PROVIDER=http://op-node-sequencer:9545

espresso/docker-compose.yml

Lines changed: 29 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,44 @@
11
# Espresso OP Integration Docker Setup
22

33
services:
4-
l1:
4+
l1-geth:
55
healthcheck:
66
test: ["CMD", "curl", "-f", "http://localhost:${ESPRESSO_L1_PORT}"]
77
interval: 3s
88
timeout: 2s
99
retries: 40
1010
build:
11-
context: ../ops/docker/deployment-utils
11+
context: ./docker/l1-geth
1212
image: l1-geth:espresso
1313
volumes:
14-
- ../config/l1-genesis-devnet.json:/l1-genesis-devnet.json:ro
15-
- l1-data:/data
16-
command:
17-
- sh
18-
- -c
19-
# Initialize with the L1 genesis file.
20-
# Enable `dev` to automatically create blocks in the dev mode.
21-
# Set `dev.period=1` to create a block every 1 second.
22-
- |
23-
set -e
24-
rm -rf /data/geth || true
25-
geth --datadir /data init /l1-genesis-devnet.json
26-
exec geth --datadir /data \
27-
--http \
28-
--http.addr=0.0.0.0 \
29-
--http.api=eth,net,web3,admin \
30-
--http.port=${ESPRESSO_L1_PORT} \
31-
--http.vhosts=* \
32-
--http.corsdomain=* \
33-
--nodiscover \
34-
--dev \
35-
--dev.period=12 \
36-
--miner.etherbase=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC \
37-
--mine \
38-
--allow-insecure-unlock \
39-
--rpc.allow-unprotected-txs
14+
- l1-geth-data:/data
15+
environment:
16+
ESPRESSO_L1_PORT: ${ESPRESSO_L1_PORT}
4017
ports:
4118
- "${ESPRESSO_L1_PORT}:${ESPRESSO_L1_PORT}" # L1 RPC
4219

4320
op-geth:
44-
# If the version below is updated, update the version for `images/op-geth` in the Docker
45-
# Compose section in README_ESPRESSO.md as well.
46-
image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101503.2-rc.3
21+
build:
22+
context: ./docker/op-geth
23+
image: op-geth:espresso
4724
depends_on:
48-
l1:
25+
l1-geth:
4926
condition: service_healthy
5027
volumes:
51-
- ../config:/config
28+
- ./docker/op-geth:/config
5229
- op-geth-data:/data
5330
environment:
5431
L1_RPC: ${ESPRESSO_L1_PROVIDER}
55-
entrypoint: ["/bin/sh", "-c"]
56-
command:
57-
# Initialize with the L2 genesis file.
58-
- |
59-
if [ ! -d "/data/geth" ]; then
60-
geth init --datadir=/data /config/l2-genesis-devnet.json
61-
fi
62-
exec geth \
63-
--datadir=/data \
64-
--networkid=1 \
65-
--http \
66-
--http.addr=0.0.0.0 \
67-
--http.port=${ESPRESSO_L1_PORT} \
68-
--http.api=eth,net,web3,debug,admin,txpool \
69-
--http.vhosts=* \
70-
--http.corsdomain=* \
71-
--authrpc.addr=0.0.0.0 \
72-
--authrpc.port=${ESPRESSO_GETH_PORT} \
73-
--authrpc.vhosts=* \
74-
--authrpc.jwtsecret=/config/jwt.txt \
75-
--rollup.disabletxpoolgossip=true \
76-
--rollup.halt=major \
77-
--nodiscover
32+
ESPRESSO_L1_PORT: ${ESPRESSO_L1_PORT}
33+
ESPRESSO_GETH_PORT: ${ESPRESSO_GETH_PORT}
7834
ports:
7935
- "8546:${ESPRESSO_L1_PORT}" # L2 RPC
8036
- "${ESPRESSO_GETH_PORT}:${ESPRESSO_GETH_PORT}" # Engine API
8137

8238
op-node-sequencer:
8339
build:
8440
context: ../
85-
dockerfile: ./ops/docker/op-stack-go/Dockerfile
41+
dockerfile: espresso/docker/op-stack/Dockerfile
8642
target: op-node-target
8743
image: op-node-sequencer:espresso
8844
depends_on:
@@ -94,19 +50,19 @@ services:
9450
OP_NODE_L2_ENGINE_RPC: ${ESPRESSO_GETH_PROVIDER}
9551
OP_NODE_RPC_PORT: ${ESPRESSO_ROLLUP_PORT}
9652
volumes:
97-
- ../config:/config
53+
- ./docker/op-geth:/config
9854
- /etc/localtime:/etc/localtime:ro
9955
command:
10056
- op-node
10157
- --l2.jwt-secret=/config/jwt.txt
102-
- --rollup.config=/config/op-node/rollup-devnet.json
58+
- --rollup.config=/config/rollup-devnet.json
10359
- --sequencer.enabled=true
10460
- --rpc.addr=0.0.0.0
10561

10662
op-node-verifier:
10763
build:
10864
context: ../
109-
dockerfile: ./ops/docker/op-stack-go/Dockerfile
65+
dockerfile: espresso/docker/op-stack/Dockerfile
11066
target: op-node-target
11167
image: op-node-verifier:espresso
11268
depends_on:
@@ -117,16 +73,16 @@ services:
11773
OP_NODE_L1_ETH_RPC: ${ESPRESSO_L1_PROVIDER}
11874
OP_NODE_L2_ENGINE_RPC: ${ESPRESSO_GETH_PROVIDER}
11975
volumes:
120-
- ../config:/config
76+
- ./docker/op-geth:/config
12177
command:
12278
- op-node
12379
- --l2.jwt-secret=/config/jwt.txt
124-
- --rollup.config=/config/op-node/rollup-devnet.json
80+
- --rollup.config=/config/rollup-devnet.json
12581

12682
caff-node:
12783
build:
12884
context: ../
129-
dockerfile: ./ops/docker/op-stack-go/Dockerfile
85+
dockerfile: espresso/docker/op-stack/Dockerfile
13086
target: op-node-target
13187
image: caff-node:espresso
13288
depends_on:
@@ -141,11 +97,11 @@ services:
14197
CAFF_ESPRESSO_LIGHT_CLIENT_ADDR: "0x703848f4c85f18e3acd8196c8ec91eb0b7bd0797"
14298
CAFF_HOTSHOT_URLS: ${ESPRESSO_URL}
14399
volumes:
144-
- ../config:/config
100+
- ./docker/op-geth:/config
145101
command:
146102
- op-node
147103
- --l2.jwt-secret=/config/jwt.txt
148-
- --rollup.config=/config/op-node/rollup-devnet.json
104+
- --rollup.config=/config/rollup-devnet.json
149105
- --caff.node=true
150106
- --sequencer.enabled=false
151107
- --verifier.l1-confs=0
@@ -161,12 +117,12 @@ services:
161117
op-batcher:
162118
build:
163119
context: ../
164-
dockerfile: ./ops/docker/op-stack-go/Dockerfile
120+
dockerfile: espresso/docker/op-stack/Dockerfile
165121
target: op-batcher-target
166122
image: op-batcher:espresso
167123
# It is not necessary to specify all dependencies, but a good practice.
168124
depends_on:
169-
l1:
125+
l1-geth:
170126
condition: service_healthy
171127
op-geth:
172128
condition: service_started
@@ -192,11 +148,12 @@ services:
192148
op-proposer:
193149
build:
194150
context: ../
195-
dockerfile: ./ops/docker/op-stack-go/Dockerfile
151+
dockerfile: espresso/docker/op-stack/Dockerfile
196152
target: op-proposer-target
197153
image: op-proposer:espresso
198154
depends_on:
199-
- op-node-sequencer
155+
op-node-sequencer:
156+
condition: service_started
200157
environment:
201158
OP_PROPOSER_L1_ETH_RPC: ${ESPRESSO_L1_PROVIDER}
202159
OP_PROPOSER_ROLLUP_RPC: ${ESPRESSO_ROLLUP_PROVIDER}
@@ -221,15 +178,15 @@ services:
221178
dockerfile: ./op-deployer/Dockerfile.default
222179
image: op-deployer:espresso
223180
depends_on:
224-
- l1
181+
- l1-geth
225182
volumes:
226183
- ../packages/contracts-bedrock/lib/superchain-registry/ops/testdata/monorepo:/config
227184
restart: "no"
228185

229186
espresso-dev-node:
230187
image: ghcr.io/espressosystems/espresso-sequencer/espresso-dev-node:release-colorful-snake
231188
depends_on:
232-
l1:
189+
l1-geth:
233190
condition: service_healthy
234191
ports:
235192
- "${ESPRESSO_SEQUENCER_API_PORT}:${ESPRESSO_SEQUENCER_API_PORT}"
@@ -251,6 +208,6 @@ services:
251208
ESPRESSO_BUILDER_PORT: ${ESPRESSO_BUILDER_PORT}
252209

253210
volumes:
254-
l1-data:
211+
l1-geth-data:
255212
op-geth-data:
256213
espresso-data:

0 commit comments

Comments
 (0)