Skip to content

Commit e0ba61a

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

File tree

1 file changed

+51
-26
lines changed

1 file changed

+51
-26
lines changed

.github/workflows/build-image.yml

+51-26
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,16 +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
94+
images: ${{ env.IBIS_IMAGE }}
8295
tags: |
8396
type=raw,value=${{ needs.prepare-tag.outputs.tag_name }}
8497
- name: Login to GitHub Container Registry
@@ -91,45 +104,57 @@ jobs:
91104
uses: docker/setup-qemu-action@v3
92105
- name: Set up Docker Buildx
93106
uses: docker/setup-buildx-action@v3
94-
- name: Build and push
95-
uses: docker/build-push-action@v5
107+
- name: Build and push by digest
108+
id: build
109+
uses: docker/build-push-action@v6
96110
with:
111+
platforms: ${{ matrix.platform }}
97112
context: ./ibis-server
98113
build-contexts: |
99114
wren-core-py=./wren-core-py
100115
wren-core=./wren-core
101-
platforms: linux/amd64
102-
push: true
103116
tags: ${{ steps.meta.outputs.tags }}
104-
build-ibis-arm64-image:
105-
needs: prepare-tag
117+
outputs: type=image,name=${{ env.IBIS_IMAGE }},push-by-digest=true,name-canonical=true,push=true
118+
- name: Export digest
119+
run: |
120+
mkdir -p /tmp/digests
121+
digest="${{ steps.build.outputs.digest }}"
122+
touch "/tmp/digests/${digest#sha256:}"
123+
- name: Upload digest
124+
uses: actions/upload-artifact@v4
125+
with:
126+
name: digests-${{ env.PLATFORM_PAIR }}
127+
path: /tmp/digests/*
128+
if-no-files-found: error
129+
retention-days: 1
130+
merge:
106131
runs-on: ubuntu-latest
132+
needs: build-ibis-image
107133
steps:
108-
- uses: actions/checkout@v4
134+
- name: Download digests
135+
uses: actions/download-artifact@v4
136+
with:
137+
path: /tmp/digests
138+
pattern: digests-*
139+
merge-multiple: true
140+
- name: Set up Docker Buildx
141+
uses: docker/setup-buildx-action@v3
109142
- name: Docker meta
110143
id: meta
111144
uses: docker/metadata-action@v5
112145
with:
113-
images: ghcr.io/canner/wren-engine-ibis
114-
tags: |
115-
type=raw,value=${{ needs.prepare-tag.outputs.tag_name }}
146+
images: ${{ env.IBIS_IMAGE }}
116147
- name: Login to GitHub Container Registry
117148
uses: docker/login-action@v3
118149
with:
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+
- name: Inspect image
159+
run: |
160+
docker buildx imagetools inspect ${{ env.IBIS_IMAGE }}:${{ steps.meta.outputs.version }}

0 commit comments

Comments
 (0)