Skip to content

Commit a308ac7

Browse files
pavanputhraclaude
andcommitted
Add linux/arm64 support via native arm64 runners (no QEMU)
- 4 parallel build jobs: api + conserver × amd64 + arm64 - amd64 on ubuntu-latest, arm64 on ubuntu-24.04-arm (native, no emulation) - Merge job combines platform digests into multi-arch manifests - Separate GHA cache scopes per service+platform Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d85a117 commit a308ac7

1 file changed

Lines changed: 83 additions & 27 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 83 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ name: Build and Push Docker images
66
# Version format: YYYY.MM.DD (e.g., 2026.01.16)
77
# If multiple releases happen on the same day, adds sequence: YYYY.MM.DD.2, YYYY.MM.DD.3, etc.
88
#
9-
# Two separate images are built and pushed:
9+
# Two separate images are built and pushed for both linux/amd64 and linux/arm64:
1010
# vcon-server-api — lightweight FastAPI/uvicorn image (main deps only)
1111
# vcon-server-conserver — full processing image (main + links + storage deps)
1212
#
13+
# Build strategy: native runners (no QEMU) for maximum speed
14+
# amd64 builds on ubuntu-latest
15+
# arm64 builds on ubuntu-24.04-arm
16+
#
1317
# Docker tags created for each image:
14-
# - CalVer tag (e.g., 2026.01.16)
18+
# - CalVer tag (e.g., 2026.01.16) [main only]
19+
# - latest [main only]
1520
# - Branch name (e.g., main)
16-
# - Git short hash (e.g., main-a1b2c3d)
17-
# - latest (for main branch only)
21+
# - Branch + short sha (e.g., main-a1b2c3d)
1822

1923
on:
2024
push:
@@ -82,7 +86,7 @@ jobs:
8286
8387
build:
8488
needs: prepare
85-
runs-on: ubuntu-latest
89+
runs-on: ${{ matrix.runner }}
8690
permissions:
8791
contents: read
8892
packages: write
@@ -92,9 +96,27 @@ jobs:
9296
- service: api
9397
dockerfile: ./docker/Dockerfile.api
9498
image: public.ecr.aws/r4g1k2s3/vcon-dev/vcon-server-api
99+
platform: linux/amd64
100+
platform_tag: amd64
101+
runner: ubuntu-latest
102+
- service: api
103+
dockerfile: ./docker/Dockerfile.api
104+
image: public.ecr.aws/r4g1k2s3/vcon-dev/vcon-server-api
105+
platform: linux/arm64
106+
platform_tag: arm64
107+
runner: ubuntu-24.04-arm
95108
- service: conserver
96109
dockerfile: ./docker/Dockerfile.conserver
97110
image: public.ecr.aws/r4g1k2s3/vcon-dev/vcon-server-conserver
111+
platform: linux/amd64
112+
platform_tag: amd64
113+
runner: ubuntu-latest
114+
- service: conserver
115+
dockerfile: ./docker/Dockerfile.conserver
116+
image: public.ecr.aws/r4g1k2s3/vcon-dev/vcon-server-conserver
117+
platform: linux/arm64
118+
platform_tag: arm64
119+
runner: ubuntu-24.04-arm
98120

99121
steps:
100122
- name: Checkout code
@@ -110,39 +132,71 @@ jobs:
110132
username: ${{ secrets.AWS_ACCESS_KEY }}
111133
password: ${{ secrets.AWS_SECRET }}
112134

113-
- name: Extract metadata
114-
id: meta
115-
uses: docker/metadata-action@v5
116-
with:
117-
images: ${{ matrix.image }}
118-
tags: |
119-
type=raw,value=${{ needs.prepare.outputs.version }},enable=${{ github.ref == 'refs/heads/main' }}
120-
type=ref,event=branch
121-
type=ref,event=pr
122-
type=semver,pattern={{version}}
123-
type=semver,pattern={{major}}.{{minor}}
124-
type=sha,prefix={{branch}}-
125-
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
126-
127-
- name: Build and push ${{ matrix.service }} image
135+
- name: Build and push ${{ matrix.service }} (${{ matrix.platform_tag }})
128136
uses: docker/build-push-action@v5
129137
with:
130138
context: .
131139
file: ${{ matrix.dockerfile }}
132-
platforms: linux/amd64
140+
platforms: ${{ matrix.platform }}
133141
push: true
134-
cache-from: type=gha,scope=${{ matrix.service }}
135-
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
136-
tags: ${{ steps.meta.outputs.tags }}
137-
labels: ${{ steps.meta.outputs.labels }}
142+
cache-from: type=gha,scope=${{ matrix.service }}-${{ matrix.platform_tag }}
143+
cache-to: type=gha,mode=max,scope=${{ matrix.service }}-${{ matrix.platform_tag }}
144+
tags: ${{ matrix.image }}:${{ github.ref_name }}-${{ matrix.platform_tag }}
138145
build-args: |
139146
VCON_SERVER_VERSION=${{ needs.prepare.outputs.version }}
140147
VCON_SERVER_GIT_COMMIT=${{ needs.prepare.outputs.short_sha }}
141148
VCON_SERVER_BUILD_TIME=${{ needs.prepare.outputs.build_time }}
142149
143-
release:
150+
merge:
144151
needs: [prepare, build]
145152
runs-on: ubuntu-latest
153+
permissions:
154+
contents: read
155+
packages: write
156+
strategy:
157+
matrix:
158+
include:
159+
- service: api
160+
image: public.ecr.aws/r4g1k2s3/vcon-dev/vcon-server-api
161+
- service: conserver
162+
image: public.ecr.aws/r4g1k2s3/vcon-dev/vcon-server-conserver
163+
164+
steps:
165+
- name: Set up Docker Buildx
166+
uses: docker/setup-buildx-action@v3
167+
168+
- name: Log in to Amazon ECR Public
169+
uses: docker/login-action@v3
170+
with:
171+
registry: public.ecr.aws
172+
username: ${{ secrets.AWS_ACCESS_KEY }}
173+
password: ${{ secrets.AWS_SECRET }}
174+
175+
- name: Create multi-arch manifest for ${{ matrix.service }}
176+
env:
177+
IMAGE: ${{ matrix.image }}
178+
VERSION: ${{ needs.prepare.outputs.version }}
179+
SHORT_SHA: ${{ needs.prepare.outputs.short_sha }}
180+
BRANCH: ${{ github.ref_name }}
181+
run: |
182+
AMD64="${IMAGE}:${BRANCH}-amd64"
183+
ARM64="${IMAGE}:${BRANCH}-arm64"
184+
185+
# Branch tag (always)
186+
docker buildx imagetools create --tag "${IMAGE}:${BRANCH}" "${AMD64}" "${ARM64}"
187+
188+
# Branch + sha tag (always)
189+
docker buildx imagetools create --tag "${IMAGE}:${BRANCH}-${SHORT_SHA}" "${AMD64}" "${ARM64}"
190+
191+
# CalVer and latest (main only)
192+
if [ "${BRANCH}" = "main" ]; then
193+
docker buildx imagetools create --tag "${IMAGE}:${VERSION}" "${AMD64}" "${ARM64}"
194+
docker buildx imagetools create --tag "${IMAGE}:latest" "${AMD64}" "${ARM64}"
195+
fi
196+
197+
release:
198+
needs: [prepare, merge]
199+
runs-on: ubuntu-latest
146200
if: github.ref == 'refs/heads/main'
147201
permissions:
148202
contents: write
@@ -160,6 +214,8 @@ jobs:
160214
161215
### Docker Images
162216
217+
Both images support `linux/amd64` and `linux/arm64`.
218+
163219
**API service** (FastAPI/uvicorn, lightweight):
164220
```bash
165221
docker pull public.ecr.aws/r4g1k2s3/vcon-dev/vcon-server-api:${{ needs.prepare.outputs.version }}
@@ -187,6 +243,6 @@ jobs:
187243
echo "| **Build Time** | ${{ needs.prepare.outputs.build_time }} |" >> $GITHUB_STEP_SUMMARY
188244
echo "| **Branch** | ${{ github.ref_name }} |" >> $GITHUB_STEP_SUMMARY
189245
echo "" >> $GITHUB_STEP_SUMMARY
190-
echo "### Docker Images Built" >> $GITHUB_STEP_SUMMARY
246+
echo "### Docker Images Built (linux/amd64 + linux/arm64)" >> $GITHUB_STEP_SUMMARY
191247
echo "- \`vcon-server-api\` — API service (main deps only)" >> $GITHUB_STEP_SUMMARY
192248
echo "- \`vcon-server-conserver\` — Conserver service (main + links + storage)" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)