Skip to content

Commit fc7d48f

Browse files
committed
Publish Docker multi-arch natively
1 parent 1b873c1 commit fc7d48f

1 file changed

Lines changed: 58 additions & 14 deletions

File tree

.github/workflows/docker.yml

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,49 @@ env:
1818
IMAGE_NAME: wangnov/codex-asr
1919

2020
jobs:
21-
image:
21+
build:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- platform: linux/amd64
27+
runner: ubuntu-latest
28+
platform_pair: linux-amd64
29+
- platform: linux/arm64
30+
runner: ubuntu-24.04-arm
31+
platform_pair: linux-arm64
32+
runs-on: ${{ matrix.runner }}
33+
steps:
34+
- uses: actions/checkout@v6
35+
36+
- uses: docker/setup-buildx-action@v3
37+
38+
- name: Log in to GHCR
39+
if: github.event_name != 'pull_request'
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ${{ env.REGISTRY }}
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Build platform image
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
platforms: ${{ matrix.platform }}
51+
push: ${{ github.event_name != 'pull_request' }}
52+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}-${{ matrix.platform_pair }}
53+
labels: |
54+
org.opencontainers.image.title=codex-asr
55+
org.opencontainers.image.description=Unofficial Codex Desktop ASR CLI and local Whisper-compatible REST shim
56+
org.opencontainers.image.source=https://github.com/Wangnov/codex-asr
57+
org.opencontainers.image.licenses=MIT
58+
cache-from: type=gha,scope=${{ matrix.platform_pair }}
59+
cache-to: type=gha,mode=max,scope=${{ matrix.platform_pair }}
60+
61+
manifest:
62+
if: github.event_name != 'pull_request'
63+
needs: build
2264
runs-on: ubuntu-latest
2365
steps:
2466
- uses: actions/checkout@v6
@@ -30,12 +72,9 @@ jobs:
3072
version="$(awk -F '"' '/^version = / { print $2; exit }' Cargo.toml)"
3173
echo "version=${version}" >> "$GITHUB_OUTPUT"
3274
33-
- uses: docker/setup-qemu-action@v3
34-
3575
- uses: docker/setup-buildx-action@v3
3676

3777
- name: Log in to GHCR
38-
if: github.event_name != 'pull_request'
3978
uses: docker/login-action@v3
4079
with:
4180
registry: ${{ env.REGISTRY }}
@@ -61,13 +100,18 @@ jobs:
61100
org.opencontainers.image.source=https://github.com/Wangnov/codex-asr
62101
org.opencontainers.image.licenses=MIT
63102
64-
- name: Build and publish Docker image
65-
uses: docker/build-push-action@v6
66-
with:
67-
context: .
68-
platforms: linux/amd64
69-
push: ${{ github.event_name != 'pull_request' }}
70-
tags: ${{ steps.meta.outputs.tags }}
71-
labels: ${{ steps.meta.outputs.labels }}
72-
cache-from: type=gha
73-
cache-to: type=gha,mode=max
103+
- name: Create multi-platform manifest
104+
env:
105+
METADATA_JSON: ${{ steps.meta.outputs.json }}
106+
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
107+
shell: bash
108+
run: |
109+
mapfile -t tags < <(jq -r '.tags[]' <<< "$METADATA_JSON")
110+
args=()
111+
for tag in "${tags[@]}"; do
112+
args+=("-t" "$tag")
113+
done
114+
docker buildx imagetools create \
115+
"${args[@]}" \
116+
"$IMAGE:build-${GITHUB_SHA}-linux-amd64" \
117+
"$IMAGE:build-${GITHUB_SHA}-linux-arm64"

0 commit comments

Comments
 (0)