Skip to content
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

ci: test multi-arch workflow #1011

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 78 additions & 1 deletion .github/workflows/docker-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ on:
type: string

jobs:

build-and-push-arm64-image:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- aarch64

timeout-minutes: 1440

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -39,3 +41,78 @@ jobs:
file: Dockerfile
push: true
tags: scrolltech/l2geth:${{inputs.tag}}-arm64
- name: Build arm64 image
run: |
docker build --platform linux/arm64/v8 -t scrolltech/l2geth:${{inputs.tag}}-arm64 .
docker push scrolltech/l2geth:${{inputs.tag}}-arm64

build-and-push-amd64-image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: scrolltech/l2geth
tags: |
type=ref,event=tag,enable=${{ github.event_name == 'push' }}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
flavor: |
latest=false
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# - name: Build docker image
# uses: docker/build-push-action@v2
# with:
# context: .
# file: Dockerfile
# push: true
# tags: scrolltech/l2geth:${{inputs.tag}}-amd64

- name: Build amd64 image
run: |
docker build --platform linux/amd64 -t scrolltech/l2geth:${{inputs.tag}}-amd64 .
docker push scrolltech/l2geth:${{inputs.tag}}-amd64

publish-multi-arch-image:
runs-on: ubuntu-latest
needs:
- build-and-push-amd64-image
- build-and-push-arm64-image
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: scrolltech/l2geth
tags: |
type=ref,event=tag,enable=${{ github.event_name == 'push' }}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
flavor: |
latest=false
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build multiarch image
run: |
docker manifest create scrolltech/l2geth:${image_multiarch_name} --amend scrolltech/l2geth:${image_amd64_name} --amend scrolltech/l2geth:${image_arm64_name} && \
docker manifest push scrolltech/l2geth:${image_multiarch_name}
env:
image_arm64_name: "${{inputs.tag}}-arm64"
image_amd64_name: "${{inputs.tag}}-amd64"
image_multiarch_name: "${{inputs.tag}}-multiarch"
Loading