Skip to content

Commit 4599bc1

Browse files
fix: make the use multi arm so arm64 can pull/run
1 parent 2b9e618 commit 4599bc1

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

.github/workflows/cd.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ jobs:
104104
with:
105105
ref: ${{ needs.prepare.outputs.source_ref }}
106106

107+
- name: Setup QEMU
108+
if: needs.prepare.outputs.should_build == 'true'
109+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130
110+
with:
111+
platforms: arm64,amd64
112+
107113
- name: Setup Docker Buildx
108114
if: needs.prepare.outputs.should_build == 'true'
109115
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
@@ -123,8 +129,11 @@ jobs:
123129
context: ./frontend
124130
file: ./frontend/Dockerfile
125131
push: true
132+
platforms: linux/amd64,linux/arm64
126133
provenance: true
127134
sbom: true
135+
cache-from: type=gha
136+
cache-to: type=gha,mode=max
128137
tags: |
129138
ghcr.io/${{ needs.prepare.outputs.ghcr_owner }}/bookapp-frontend:${{ needs.prepare.outputs.image_tag }}
130139
ghcr.io/${{ needs.prepare.outputs.ghcr_owner }}/bookapp-frontend:latest
@@ -136,12 +145,35 @@ jobs:
136145
context: ./backend
137146
file: ./backend/Dockerfile
138147
push: true
148+
platforms: linux/amd64,linux/arm64
139149
provenance: true
140150
sbom: true
151+
cache-from: type=gha
152+
cache-to: type=gha,mode=max
141153
tags: |
142154
ghcr.io/${{ needs.prepare.outputs.ghcr_owner }}/bookapp-backend:${{ needs.prepare.outputs.image_tag }}
143155
ghcr.io/${{ needs.prepare.outputs.ghcr_owner }}/bookapp-backend:latest
144156
157+
- name: Verify image manifests
158+
if: needs.prepare.outputs.should_build == 'true'
159+
shell: bash
160+
run: |
161+
set -euo pipefail
162+
163+
frontend_ref="ghcr.io/${{ needs.prepare.outputs.ghcr_owner }}/bookapp-frontend:${{ needs.prepare.outputs.image_tag }}"
164+
backend_ref="ghcr.io/${{ needs.prepare.outputs.ghcr_owner }}/bookapp-backend:${{ needs.prepare.outputs.image_tag }}"
165+
166+
frontend_manifest="$(docker buildx imagetools inspect "$frontend_ref")"
167+
backend_manifest="$(docker buildx imagetools inspect "$backend_ref")"
168+
169+
echo "$frontend_manifest" | grep -q "linux/amd64"
170+
echo "$frontend_manifest" | grep -q "linux/arm64"
171+
172+
echo "$backend_manifest" | grep -q "linux/amd64"
173+
echo "$backend_manifest" | grep -q "linux/arm64"
174+
175+
echo "Verified multi-arch manifests for $frontend_ref and $backend_ref"
176+
145177
- name: Skip image build for rollback
146178
if: needs.prepare.outputs.should_build != 'true'
147179
run: echo "Rollback mode selected, skipping image build and push."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ GHCR note: you do not need a separate GHCR account; GHCR uses your existing GitH
238238
- Auto deploy runs only after CI succeeds on the default branch (`master` in this repo; `main` also supported) via `workflow_run`
239239
- Manual runs supported through `workflow_dispatch`
240240
- Supports rollback mode with an explicit image tag
241-
- Builds and pushes images to GHCR:
241+
- Builds and pushes multi-arch images (`linux/amd64`, `linux/arm64`) to GHCR:
242242
- `ghcr.io/<owner>/bookapp-frontend`
243243
- `ghcr.io/<owner>/bookapp-backend`
244244
- Deploys on a self-hosted Linux runner with label `bookapp-prod`

0 commit comments

Comments
 (0)