Skip to content

Commit ebb8e76

Browse files
authored
Add op-batcher-tee image in CI (#210)
* push op-batcher-tee image init * fix tag and push * test image creation without enclaver * try to use env * fix enclaver download * use env in docker images yml * restore other task * remove unneeded steps
1 parent f462128 commit ebb8e76

File tree

3 files changed

+102
-18
lines changed

3 files changed

+102
-18
lines changed

.github/workflows/docker-images.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,100 @@ jobs:
394394
TARGET_BASE_IMAGE=alpine:3.22
395395
TARGETOS=linux
396396
TARGETARCH=amd64
397+
398+
build-op-batcher-tee:
399+
runs-on: ubuntu-latest
400+
permissions:
401+
contents: read
402+
packages: write
403+
env:
404+
ENCLAVE_APP_IMAGE: op-batcher-enclave:app
405+
steps:
406+
- name: Checkout
407+
uses: actions/checkout@v4
408+
409+
- name: Install just
410+
uses: extractions/setup-just@v2
411+
412+
- name: Install Rust
413+
uses: actions-rs/toolchain@v1
414+
with:
415+
toolchain: stable
416+
override: true
417+
418+
- name: Install Foundry
419+
uses: foundry-rs/foundry-toolchain@v1
420+
with:
421+
version: nightly
422+
423+
- name: Install dasel
424+
run: |
425+
curl -sSL "https://github.com/TomWright/dasel/releases/latest/download/dasel_linux_amd64" -o /tmp/dasel
426+
sudo mv /tmp/dasel /usr/local/bin/dasel
427+
sudo chmod +x /usr/local/bin/dasel
428+
dasel --version
429+
430+
- name: Check for package.json
431+
id: check-package
432+
run: |
433+
if [ -f "package.json" ]; then
434+
echo "has-package=true" >> $GITHUB_OUTPUT
435+
else
436+
echo "has-package=false" >> $GITHUB_OUTPUT
437+
fi
438+
439+
- name: Setup Node.js
440+
if: steps.check-package.outputs.has-package == 'true'
441+
uses: actions/setup-node@v4
442+
with:
443+
node-version: '18'
444+
cache: 'npm'
445+
446+
- name: Run Enclaver installation
447+
run: |
448+
echo "Downloading and installing Enclaver..."
449+
ARCH=$(uname -m)
450+
LATEST_RELEASE=$(curl -s https://api.github.com/repositories/516492075/releases/latest)
451+
DOWNLOAD_URL=$(echo "$LATEST_RELEASE" | jq -r ".assets[] | select(.name | test(\"^enclaver-linux-$ARCH.*tar.gz$\")) | .browser_download_url")
452+
if [ -z "$DOWNLOAD_URL" ]; then
453+
echo "Could not find Enclaver download URL"
454+
exit 1
455+
fi
456+
curl -L "$DOWNLOAD_URL" -o enclaver.tar.gz
457+
tar xzf enclaver.tar.gz
458+
sudo install enclaver-*/enclaver /usr/local/bin/
459+
rm -rf enclaver.tar.gz enclaver-*
460+
enclaver --version
461+
462+
- name: Install dependencies
463+
if: steps.check-package.outputs.has-package == 'true'
464+
run: npm ci
465+
466+
- name: Build op-batcher enclave image
467+
run: |
468+
cd espresso
469+
./scripts/batcher-enclave-image.sh
470+
471+
- name: Login to GitHub Container Registry
472+
uses: docker/login-action@v3
473+
with:
474+
registry: ${{ env.REGISTRY }}
475+
username: ${{ github.actor }}
476+
password: ${{ secrets.GITHUB_TOKEN }}
477+
478+
- name: Extract metadata
479+
id: meta
480+
uses: docker/metadata-action@v5
481+
with:
482+
images: ${{ env.IMAGE_PREFIX }}/op-batcher-tee
483+
tags: |
484+
type=ref,event=branch
485+
type=ref,event=pr
486+
type=sha,prefix={{branch}}-,enable={{is_default_branch}}
487+
type=raw,value=latest,enable={{is_default_branch}}
488+
type=raw,value=pr-${{ github.event.number }},enable=${{ github.event_name == 'pull_request' }}
489+
490+
- name: Tag and push op-batcher-tee image
491+
run: |
492+
docker tag "${{ env.ENCLAVE_APP_IMAGE }}" ${{ steps.meta.outputs.tags }}
493+
docker push ${{ steps.meta.outputs.tags }}

espresso/docker/op-stack/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ COPY --from=op-node-builder /app/op-node/bin/op-node /usr/local/bin/
113113
# Create config directory
114114
RUN mkdir -p /config
115115

116-
# Include the config.
117-
COPY espresso/deployment/l2-config /config
118116

119117
CMD ["op-node"]
120118

espresso/scripts/batcher-enclave-image.sh

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,13 @@ export ENCLAVE_APP_IMAGE="op-batcher-enclave:app"
2020
export ENCLAVE_TARGET_IMAGE="op-batcher-enclaver:tests"
2121
export MANIFEST_FILE="batcher-enclave.yaml"
2222

23-
# Required for enclave operations
24-
if [[ ! -e /dev/nitro_enclaves ]]; then
25-
echo "Error: /dev/nitro_enclaves device not found. Are you running on a Nitro-enabled instance?"
26-
exit 1
27-
fi
28-
29-
# Check if docker is running
30-
if ! docker info > /dev/null 2>&1; then
31-
echo "Error: Docker is not running or not accessible"
32-
exit 1
33-
fi
3423

3524
echo "Using HOST_IP: $HOST_IP"
3625
echo "Ports -> L1:$L1_HTTP_PORT L2:$OP_HTTP_PORT Rollup:$ROLLUP_PORT EspressoAPI:$ESPRESSO_SEQUENCER_API_PORT"
3726

3827
# Step 1: Build the Docker image using your existing Dockerfile
3928
echo "Building Docker image..."
40-
docker build -t $ENCLAVE_APP_IMAGE \
29+
docker build -t "$ENCLAVE_APP_IMAGE" \
4130
-f ../ops/docker/op-stack-go/Dockerfile \
4231
--target op-batcher-enclave-target \
4332
--build-arg ENCLAVE_BATCHER_ARGS="--l1-eth-rpc=http://$HOST_IP:$L1_HTTP_PORT \
@@ -58,7 +47,7 @@ fi
5847

5948
# Step 2: Create enclaver manifest
6049
echo "Creating enclaver manifest..."
61-
cat > $MANIFEST_FILE << EOL
50+
cat > "$MANIFEST_FILE" << EOL
6251
version: v1
6352
name: "op-batcher-enclave"
6453
target: "$ENCLAVE_TARGET_IMAGE"
@@ -77,18 +66,18 @@ egress:
7766
EOL
7867

7968
echo "Manifest created:"
80-
cat $MANIFEST_FILE
69+
cat "$MANIFEST_FILE"
8170

8271
# Step 3: Build the enclave
8372
echo "Building enclave..."
84-
sudo enclaver build --file $MANIFEST_FILE
73+
sudo enclaver build --file "$MANIFEST_FILE"
8574

8675
if [ $? -ne 0 ]; then
8776
echo "Failed to build enclave"
8877
exit 1
8978
fi
9079

91-
# Step 4: Run the enclave
80+
# Step 4: Run the enclave (commented out as in original)
9281
# echo "Running enclave..."
9382
# docker run --rm --privileged --net=host \
9483
# --name batcher-enclaver-$RANDOM \

0 commit comments

Comments
 (0)