diff --git a/.github/workflows/docker-hub-platform.yml b/.github/workflows/docker-hub-platform.yml index f9e97096b..32f9fe5d2 100644 --- a/.github/workflows/docker-hub-platform.yml +++ b/.github/workflows/docker-hub-platform.yml @@ -72,6 +72,25 @@ jobs: run: | ./docker-compose.sh platform + # - name: Generate images + # if: github.event_name != 'pull_request' + # run: | + # for tag in "deps" "dev" "runtime" "cli"; do + # mkdir -p "/tmp/images/${tag}" + # digest="$(docker images --no-trunc --quiet metacall/core:${tag})" + # echo "FROM metacall/core:${tag}@${digest}" &> "/tmp/images/${tag}/Dockerfile" + # done + + # - name: Build and push by digest (deps) + # id: build + # uses: docker/build-push-action@v6 + # if: github.event_name != 'pull_request' + # with: + # context: /tmp/images/deps/Dockerfile + # platforms: ${{ matrix.platform }} + # labels: ${{ steps.meta.outputs.labels }} + # outputs: type=image,name=docker.io/${{ env.IMAGE_NAME }}:deps,push-by-digest=true,name-canonical=true,push=true + - name: Export digests if: github.event_name != 'pull_request' run: | @@ -79,7 +98,7 @@ jobs: echo "PLATFORM=${PLATFORM//\//-}" >> $GITHUB_ENV for tag in "deps" "dev" "runtime" "cli"; do mkdir -p "/tmp/digests/${tag}" - digest="$(docker images --no-trunc --quiet metacall/core:$tag)" + digest="$(docker images --no-trunc --quiet metacall/core:${tag})" touch "/tmp/digests/${tag}/${digest#sha256:}" done @@ -128,17 +147,18 @@ jobs: run: | for tag in "deps" "dev" "runtime" "cli"; do cd "/tmp/digests/${tag}" - IMAGE_HASHES=$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) - for image in $IMAGE_HASHES; do - docker push $image + IMAGE_HASHES=$(printf '${{ env.IMAGE_NAME }}:${tag}@sha256:%s ' *) + for image in ${IMAGE_HASHES}; do + docker image tag ${image} ${{ env.IMAGE_NAME }}:${tag} + docker push ${{ env.IMAGE_NAME }}:${tag} done - docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:$tag $IMAGE_HASHES + docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:${tag} ${IMAGE_HASHES} if [[ "${tag}" = "cli" ]]; then - docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:latest $IMAGE_HASHES + docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:latest ${IMAGE_HASHES} if [[ "${{ contains(github.ref, 'refs/tags/') }}" = true ]]; then TAG=${GITHUB_REF#refs/*/} VERSION=${TAG#v} - docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:$VERSION $IMAGE_HASHES + docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:${VERSION} ${IMAGE_HASHES} fi fi done