Skip to content

Commit a56b2bb

Browse files
kpiwkoclaude
andcommitted
ci: multi-arch container build using Buildah on native amd64 + arm64 runners
Builds per-arch images on native GitHub-hosted runners (ubuntu-24.04 and ubuntu-24.04-arm), then merges into a multi-platform manifest on ghcr.io. No QEMU emulation needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 26de94a commit a56b2bb

1 file changed

Lines changed: 48 additions & 12 deletions

File tree

.github/workflows/container.yaml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,55 @@ on:
77
- 'v*'
88
pull_request:
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
build:
12-
runs-on: ubuntu-latest
16+
runs-on: ${{ matrix.runner }}
17+
strategy:
18+
matrix:
19+
include:
20+
- arch: amd64
21+
runner: ubuntu-24.04
22+
- arch: arm64
23+
runner: ubuntu-24.04-arm
1324
permissions:
1425
contents: read
1526
packages: write
1627

1728
steps:
1829
- uses: actions/checkout@v4
1930

20-
- name: Log in to ghcr.io
31+
- name: Build image
32+
id: build
33+
uses: redhat-actions/buildah-build@v2
34+
with:
35+
image: gmail-mcp-server
36+
tags: ${{ github.sha }}-${{ matrix.arch }}
37+
containerfiles: ./Containerfile
38+
platforms: linux/${{ matrix.arch }}
39+
40+
- name: Push per-arch image
2141
if: github.event_name != 'pull_request'
22-
uses: docker/login-action@v3
42+
uses: redhat-actions/push-to-registry@v2
43+
with:
44+
image: ${{ steps.build.outputs.image }}
45+
tags: ${{ steps.build.outputs.tags }}
46+
registry: ghcr.io/${{ github.repository_owner }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
manifest:
51+
needs: build
52+
if: github.event_name != 'pull_request'
53+
runs-on: ubuntu-24.04
54+
permissions:
55+
packages: write
56+
57+
steps:
58+
- uses: docker/login-action@v3
2359
with:
2460
registry: ghcr.io
2561
username: ${{ github.actor }}
@@ -32,15 +68,15 @@ jobs:
3268
images: ghcr.io/${{ github.repository_owner }}/gmail-mcp-server
3369
tags: |
3470
type=raw,value=latest,enable={{is_default_branch}}
35-
type=ref,event=pr
3671
type=semver,pattern={{version}}
3772
type=semver,pattern={{major}}.{{minor}}
3873
39-
- name: Build and push
40-
uses: docker/build-push-action@v6
41-
with:
42-
context: .
43-
file: ./Containerfile
44-
push: ${{ github.event_name != 'pull_request' }}
45-
tags: ${{ steps.meta.outputs.tags }}
46-
labels: ${{ steps.meta.outputs.labels }}
74+
- name: Create and push multi-arch manifest
75+
run: |
76+
IMAGE="ghcr.io/${{ github.repository_owner }}/gmail-mcp-server"
77+
while IFS= read -r tag; do
78+
docker buildx imagetools create \
79+
-t "$tag" \
80+
"${IMAGE}:${{ github.sha }}-amd64" \
81+
"${IMAGE}:${{ github.sha }}-arm64"
82+
done <<< "${{ steps.meta.outputs.tags }}"

0 commit comments

Comments
 (0)