Skip to content

Commit a6a3a94

Browse files
authored
ci: build evm single app on PRs (#2381)
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview I noticed the evm image isn't being pushed, the Dockerfile existed to be used for local testing (unsure if it's being actively used right now?) This PR updates it to use a multi stage build, and pushes to the ghcr registry. This will allow for testing w/tastora <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a new Docker image build and push process for the EVM single application, making it available as a separate image. - **Chores** - Renamed the main Docker image build workflow for clarity. - Updated workflow dependencies to reflect the new job names. - Improved the Dockerfile for the EVM single application to streamline and automate the build process. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent bc16469 commit a6a3a94

2 files changed

Lines changed: 45 additions & 19 deletions

File tree

.github/workflows/test.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ on:
99
type: string
1010

1111
jobs:
12-
build-docker-image:
13-
name: Build Docker Image
12+
build-rollkit-image:
13+
name: Build Rollkit Docker Image
1414
# skip building images for merge groups as they are already built on PRs and main
1515
if: github.event_name != 'merge_group'
1616
runs-on: ubuntu-latest
17+
permissions:
18+
packages: write
1719
steps:
1820
- name: Checkout code
1921
uses: actions/checkout@v4
@@ -28,17 +30,47 @@ jobs:
2830
username: ${{ github.actor }}
2931
password: ${{ secrets.GITHUB_TOKEN }}
3032

31-
- name: Build and push Docker image with PR tag
33+
- name: Build and push rollkit Docker image
3234
uses: docker/build-push-action@v6
3335
with:
3436
context: .
3537
push: true
3638
platforms: linux/amd64,linux/arm64
3739
tags: ghcr.io/${{ github.repository_owner }}/rollkit:${{ inputs.image-tag }}
3840

41+
build-rollkit-evm-single-image:
42+
name: Build Rollkit EVM Single Docker Image
43+
# skip building images for merge groups as they are already built on PRs and main
44+
if: github.event_name != 'merge_group'
45+
runs-on: ubuntu-latest
46+
permissions:
47+
packages: write
48+
steps:
49+
- name: Checkout code
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
- name: Log in to GHCR
56+
uses: docker/login-action@v3
57+
with:
58+
registry: ghcr.io
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Build and push rollkit-evm-single Docker image
63+
uses: docker/build-push-action@v6
64+
with:
65+
context: .
66+
file: apps/evm/single/Dockerfile
67+
push: true
68+
platforms: linux/amd64,linux/arm64
69+
tags: ghcr.io/${{ github.repository_owner }}/rollkit-evm-single:${{ inputs.image-tag }}
70+
3971
docker-tests:
4072
name: Docker E2E Tests
41-
needs: build-docker-image
73+
needs: build-rollkit-image
4274
runs-on: ubuntu-latest
4375
steps:
4476
- uses: actions/checkout@v4

apps/evm/single/Dockerfile

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
1-
# Make sure to build this from the root of the directory: rollkit
2-
# docker build -f apps/evm/single/Dockerfile -t ghcr.io/rollkit/rollkit-evm-single:<version> .
3-
41
FROM golang:1.24-alpine AS build-env
52

63
WORKDIR /src
74

8-
COPY . .
5+
ADD core core
96

10-
# Uncomment the following lines to build the binary from source in the dockerfile directly
11-
# WORKDIR /src/apps/evm/single
7+
COPY go.mod go.sum ./
8+
RUN go mod download
129

13-
# RUN go mod tidy -compat=1.19 && \
14-
# CGO_ENABLED=0 go build -o /src/evm-single .
10+
COPY . .
1511

12+
WORKDIR /src/apps/evm/single
13+
RUN go mod tidy && CGO_ENABLED=0 GOOS=linux go build -o evm-single .
1614

1715
FROM alpine:3.18.3
1816

19-
WORKDIR /root
17+
RUN apk --no-cache add ca-certificates
2018

21-
# Copy the binary from evm-single
22-
# Make sure to build it first with the following command:
23-
# GOOS=linux GOARCH=amd64 go build -o evm-single .
24-
COPY apps/evm/single/evm-single /usr/bin/evm-single
19+
WORKDIR /root
2520

26-
# Uncomment the following lines to build the binary from source in the dockerfile directly
27-
# COPY --from=build-env /src/evm-single /usr/bin/evm-single
21+
COPY --from=build-env /src/apps/evm/single/evm-single /usr/bin/evm-single
2822
COPY apps/evm/single/entrypoint.sh /usr/bin/entrypoint.sh
2923
RUN chmod +x /usr/bin/entrypoint.sh
3024

0 commit comments

Comments
 (0)