Skip to content

Commit a2192a6

Browse files
committed
ci(image): adjust for lost amd64
1 parent 0bcab46 commit a2192a6

File tree

1 file changed

+53
-27
lines changed

1 file changed

+53
-27
lines changed

.github/workflows/build-image.yml

+53-27
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
type: string
88
description: Docker image tag name (Optional)
99

10+
env:
11+
IBIS_IMAGE: ghcr.io/canner/wren-engine-ibis
12+
1013
jobs:
1114
prepare-tag:
1215
runs-on: ubuntu-latest
@@ -69,18 +72,26 @@ jobs:
6972
build-args: |
7073
WREN_VERSION=${{ steps.prepare.outputs.WREN_VERSION }}
7174
push: true
72-
build-ibis-amd64-image:
75+
build-ibis-image:
7376
needs: prepare-tag
7477
runs-on: ubuntu-latest
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
platform:
82+
- linux/amd64
83+
- linux/arm64
7584
steps:
85+
- name: Prepare platform
86+
run: |
87+
platform=${{ matrix.platform }}
88+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
7689
- uses: actions/checkout@v4
7790
- name: Docker meta
7891
id: meta
7992
uses: docker/metadata-action@v5
8093
with:
81-
images: ghcr.io/canner/wren-engine-ibis
82-
tags: |
83-
type=raw,value=${{ needs.prepare-tag.outputs.tag_name }}
94+
images: ${{ env.IBIS_IMAGE }}
8495
- name: Login to GitHub Container Registry
8596
uses: docker/login-action@v3
8697
with:
@@ -91,26 +102,46 @@ jobs:
91102
uses: docker/setup-qemu-action@v3
92103
- name: Set up Docker Buildx
93104
uses: docker/setup-buildx-action@v3
94-
- name: Build and push
95-
uses: docker/build-push-action@v5
105+
- name: Build and push by digest
106+
id: build
107+
uses: docker/build-push-action@v6
96108
with:
109+
platforms: ${{ matrix.platform }}
110+
labels: ${{ steps.meta.outputs.labels }}
97111
context: ./ibis-server
98112
build-contexts: |
99113
wren-core-py=./wren-core-py
100114
wren-core=./wren-core
101-
platforms: linux/amd64
102-
push: true
103-
tags: ${{ steps.meta.outputs.tags }}
104-
build-ibis-arm64-image:
105-
needs: prepare-tag
115+
outputs: type=image,name=${{ env.IBIS_IMAGE }},push-by-digest=true,name-canonical=true,push=true
116+
- name: Export digest
117+
run: |
118+
mkdir -p /tmp/digests
119+
digest="${{ steps.build.outputs.digest }}"
120+
touch "/tmp/digests/${digest#sha256:}"
121+
- name: Upload digest
122+
uses: actions/upload-artifact@v4
123+
with:
124+
name: digests-${{ env.PLATFORM_PAIR }}
125+
path: /tmp/digests/*
126+
if-no-files-found: error
127+
retention-days: 1
128+
merge:
106129
runs-on: ubuntu-latest
130+
needs: build-ibis-image
107131
steps:
108-
- uses: actions/checkout@v4
132+
- name: Download digests
133+
uses: actions/download-artifact@v4
134+
with:
135+
path: /tmp/digests
136+
pattern: digests-*
137+
merge-multiple: true
138+
- name: Set up Docker Buildx
139+
uses: docker/setup-buildx-action@v3
109140
- name: Docker meta
110141
id: meta
111142
uses: docker/metadata-action@v5
112143
with:
113-
images: ghcr.io/canner/wren-engine-ibis
144+
images: ${{ env.IBIS_IMAGE }}
114145
tags: |
115146
type=raw,value=${{ needs.prepare-tag.outputs.tag_name }}
116147
- name: Login to GitHub Container Registry
@@ -119,17 +150,12 @@ jobs:
119150
registry: ghcr.io
120151
username: ${{ github.actor }}
121152
password: ${{ secrets.GITHUB_TOKEN }}
122-
- name: Set up QEMU
123-
uses: docker/setup-qemu-action@v3
124-
- name: Set up Docker Buildx
125-
uses: docker/setup-buildx-action@v3
126-
- name: Build and push
127-
uses: docker/build-push-action@v5
128-
with:
129-
context: ./ibis-server
130-
build-contexts: |
131-
wren-core-py=./wren-core-py
132-
wren-core=./wren-core
133-
platforms: linux/arm64
134-
push: true
135-
tags: ${{ steps.meta.outputs.tags }}
153+
- name: Create manifest list and push
154+
working-directory: /tmp/digests
155+
run: |
156+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
157+
$(printf '${{ env.IBIS_IMAGE }}@sha256:%s ' *) \
158+
--tag ${{ env.IBIS_IMAGE }}:${{ steps.meta.outputs.tags }}
159+
- name: Inspect image
160+
run: |
161+
docker buildx imagetools inspect ${{ env.IBIS_IMAGE }}:${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)