Skip to content

Commit 6b2281f

Browse files
committed
Build arm64 docker images
1 parent c3ff28c commit 6b2281f

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/go.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ jobs:
7474
if-no-files-found: error
7575

7676
build-docker:
77-
runs-on: ubuntu-latest
77+
runs-on: ${{ matrix.runs-on }}
78+
strategy:
79+
matrix:
80+
include:
81+
- runs-on: ubuntu-latest
82+
target: amd64
83+
- runs-on: ubuntu-arm64
84+
target: arm64
7885
steps:
7986
- name: Set up Docker Buildx
8087
uses: docker/setup-buildx-action@v3
@@ -92,7 +99,7 @@ jobs:
9299
cache-from: ${{ env.GHCR_REGISTRY_IMAGE }}:latest
93100
pull: true
94101
file: docker/Dockerfile
95-
tags: ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}
102+
tags: ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}-${{ matrix.target }}
96103
push: true
97104
build-args: |
98105
COMMIT_HASH=${{ github.sha }}
@@ -101,7 +108,6 @@ jobs:
101108
runs-on: ubuntu-latest
102109
needs:
103110
- build-docker
104-
if: github.ref == 'refs/heads/main'
105111
steps:
106112
- name: Login to registry
107113
uses: docker/login-action@v3
@@ -110,6 +116,15 @@ jobs:
110116
username: ${{ github.actor }}
111117
password: ${{ secrets.GITHUB_TOKEN }}
112118

113-
- uses: beeper/docker-retag-push-latest@main
114-
with:
115-
image: ${{ env.GHCR_REGISTRY_IMAGE }}
119+
- name: Create commit manifest
120+
run: |
121+
docker pull ${{ inputs.image }}:${{ github.sha }}-amd64
122+
docker pull ${{ inputs.image }}:${{ github.sha }}-arm64
123+
docker manifest create ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }} ${{ inputs.image }}:${{ github.sha }}-amd64 ${{ inputs.image }}:${{ github.sha }}-arm64
124+
docker manifest push ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}
125+
126+
- uses: Create :latest manifest
127+
if: github.ref == 'refs/heads/main'
128+
run: |
129+
docker manifest create ${{ env.GHCR_REGISTRY_IMAGE }}:latest ${{ inputs.image }}:${{ github.sha }}-amd64 ${{ inputs.image }}:${{ github.sha }}-arm64
130+
docker manifest push ${{ env.GHCR_REGISTRY_IMAGE }}:latest

0 commit comments

Comments
 (0)