-
Notifications
You must be signed in to change notification settings - Fork 154
ci(l1,l2): add ARM builds for Docker #5465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7ae7728
fix(l2): download ARM version on ARM Docker builds
ManuelBilbao 51c4880
Push ARM docker images for releases
ManuelBilbao f9dcf7e
Fix manifest push for multi-platform
ManuelBilbao 1636470
Fix names
ManuelBilbao 1a5a884
Dont push on workflow dispatch
ManuelBilbao 0129ad2
Merge branch 'main' into docker_arm_support
ManuelBilbao 8e94d56
Quote uname arch result
ManuelBilbao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -301,16 +301,25 @@ jobs: | |
| path: ethrex-contracts.tar.gz | ||
|
|
||
| build-docker: | ||
| name: "Build and publish ethrex docker image" | ||
| runs-on: ubuntu-latest | ||
| name: "Build ethrex docker images" | ||
| strategy: | ||
| matrix: | ||
| platform: | ||
| - ubuntu-latest | ||
| - ubuntu-22.04-arm | ||
| include: | ||
| - platform: ubuntu-latest | ||
| arch: amd64 | ||
| - platform: ubuntu-22.04-arm | ||
| arch: arm64 | ||
| runs-on: ${{ matrix.platform }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docker supports cross-platform builds using QEMU, but in my tests there were to much slower than build them in parallel natively |
||
| outputs: | ||
| tag: ${{ steps.tag_version.outputs.tag }} | ||
ManuelBilbao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| attestations: write | ||
| id-token: write | ||
| actions: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
|
|
@@ -319,38 +328,71 @@ jobs: | |
| - name: Free Disk Space | ||
| uses: ./.github/actions/free-disk | ||
|
|
||
| - name: Format name | ||
| - name: Determine tag version | ||
| id: tag_version | ||
| run: | | ||
| # For branch builds (main) we want docker images tagged as 'main'. For tag pushes | ||
| # use the tag name (stripped of a leading 'v'). | ||
| if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then | ||
| echo "TAG_VERSION=main" >> $GITHUB_ENV | ||
| echo "tag=main" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "TAG_VERSION=$(echo ${{ github.ref_name }} | tr -d v)" >> $GITHUB_ENV | ||
| echo "tag=$(echo ${{ github.ref_name }} | tr -d v)" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| # Pushes to ghcr.io/lambdaclass/ethrex | ||
| - name: Build and push L1 Docker image | ||
| id: push_l1 | ||
| - name: Build L1 Docker image | ||
| id: build_l1 | ||
| uses: ./.github/actions/build-docker | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| push: ${{ github.event_name != 'workflow_dispatch'}} | ||
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }} | ||
| push: true | ||
ManuelBilbao marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}-${{ matrix.arch }} | ||
| platforms: linux/${{ matrix.arch }} | ||
|
|
||
| # Pushes to ghcr.io/lambdaclass/ethrex | ||
| - name: Build and push L2 Docker image | ||
| id: push_l2 | ||
| - name: Build L2 Docker image | ||
| id: build_l2 | ||
| uses: ./.github/actions/build-docker | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| push: ${{ github.event_name != 'workflow_dispatch'}} | ||
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}-l2 | ||
| push: true | ||
ManuelBilbao marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG_VERSION }}-l2-${{ matrix.arch }} | ||
| build_args: BUILD_FLAGS=--features l2,l2-sql | ||
| platforms: linux/${{ matrix.arch }} | ||
|
|
||
| publish-docker: | ||
| name: "Create and push multi-arch Docker manifests" | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event_name != 'workflow_dispatch'}} | ||
| needs: build-docker | ||
|
|
||
| permissions: | ||
| packages: write | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Login to Docker registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Create multi-arch image | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build-docker.outputs.tag }} \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build-docker.outputs.tag }}-amd64 \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build-docker.outputs.tag }}-arm64 | ||
|
|
||
| docker buildx imagetools create \ | ||
| -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build-docker.outputs.tag }}-l2 \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build-docker.outputs.tag }}-l2-amd64 \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.build-docker.outputs.tag }}-l2-arm64 | ||
|
|
||
| # Creates a release on GitHub with the binaries | ||
| finalize-release: | ||
|
|
@@ -359,6 +401,7 @@ jobs: | |
| - build-ethrex | ||
| - build-ethrex-guest | ||
| - build-docker | ||
| - publish-docker | ||
| - package-contracts | ||
| - package-ethrex-guest | ||
| runs-on: ubuntu-latest | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the description is stale. This is not a list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although in most cases it'd be a single platform (for perfomance issues), it can technically be a list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also addressed Copilot comments