Skip to content

Commit 41b56e9

Browse files
committed
Problem: still no luck building images
Solution: try a solution from Docker docs https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
1 parent 931a5aa commit 41b56e9

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

.github/workflows/image.yml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,27 @@ jobs:
5454
with:
5555
platforms: linux/${{ matrix.platform }}
5656
context: .
57-
push: true
58-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-${{ matrix.platform }}
57+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
5958
labels: ${{ steps.meta.outputs.labels }}
6059
allow: security.insecure
6160
cache-from: type=gha,url=http://127.0.0.1:49160/
6261
cache-to: type=gha,url=http://127.0.0.1:49160/,mode=max
6362

63+
- name: Export digest
64+
run: |
65+
mkdir -p /tmp/digests
66+
digest="${{ steps.build.outputs.digest }}"
67+
touch "/tmp/digests/${digest#sha256:}"
68+
69+
- name: Upload digest
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: digests-${{ env.PLATFORM_PAIR }}
73+
path: /tmp/digests/*
74+
if-no-files-found: error
75+
retention-days: 1
76+
77+
6478
manifest:
6579

6680
needs: build
@@ -76,15 +90,25 @@ jobs:
7690
username: ${{ github.actor }}
7791
password: ${{ secrets.GITHUB_TOKEN }}
7892

79-
- name: Extract metadata (tags, labels) for Docker
93+
- name: Download digests
94+
uses: actions/download-artifact@v4
95+
with:
96+
path: /tmp/digests
97+
pattern: digests-*
98+
merge-multiple: true
99+
100+
- name: Docker meta
80101
id: meta
81102
uses: docker/metadata-action@v5
82103
with:
83-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
104+
images: ${{ env.REGISTRY_IMAGE }}
84105

85-
- name: Create and push manifest images
86-
uses: Noelware/docker-manifest-action@master # or use a pinned version in the Releases tab
87-
with:
88-
inputs: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
89-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-amd64,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-arm64
90-
push: true
106+
- name: Create manifest list and push
107+
working-directory: /tmp/digests
108+
run: |
109+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
110+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
111+
112+
- name: Inspect image
113+
run: |
114+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

0 commit comments

Comments
 (0)