From da2c53fd8ab5767e4a308c54545c4f43b62d7043 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 24 Jan 2026 16:50:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=86=E9=96=8B=E8=99=95=E7=90=86=20G?= =?UTF-8?q?HCR=20=E5=92=8C=20Docker=20Hub=20manifest=20=E6=8E=A8=E9=80=81?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E8=B7=A8=20registry=20400=20?= =?UTF-8?q?=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-build-lite.yml | 45 +++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build-lite.yml b/.github/workflows/docker-build-lite.yml index 8df7b2b..d23f2da 100644 --- a/.github/workflows/docker-build-lite.yml +++ b/.github/workflows/docker-build-lite.yml @@ -302,19 +302,58 @@ jobs: run: | echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT - - name: Create manifest list and push + # ======================================== + # 步驟 1:建立 GHCR manifest + # ======================================== + - name: Create manifest list and push to GHCR working-directory: /tmp/digests run: | + echo "========================================" + echo "📦 建立 GHCR manifest" + echo "========================================" docker buildx imagetools create \ - $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + -t ghcr.io/${{ env.REPO }}:${{ steps.version.outputs.VERSION }} \ + -t ghcr.io/${{ env.REPO }}:latest-lite \ --annotation='index:org.opencontainers.image.description=ConvertX-CN Lite - 輕量版檔案轉換服務' \ --annotation='index:org.opencontainers.image.created=${{ steps.timestamp.outputs.timestamp }}' \ --annotation='index:org.opencontainers.image.url=${{ github.event.repository.url }}' \ --annotation='index:org.opencontainers.image.source=${{ github.event.repository.url }}' \ $(printf 'ghcr.io/${{ env.REPO }}@sha256:%s ' *) + echo "✅ GHCR manifest 建立完成" - - name: Inspect image + # ======================================== + # 步驟 2:複製到 Docker Hub(分開處理避免跨 registry 問題) + # ======================================== + - name: Copy manifest to Docker Hub run: | + echo "========================================" + echo "📦 複製 manifest 到 Docker Hub" + echo "========================================" + + # 從 GHCR 複製到 Docker Hub + echo "🔄 複製 ${{ steps.version.outputs.VERSION }} 到 Docker Hub..." + docker buildx imagetools create \ + -t ${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.VERSION }} \ + ghcr.io/${{ env.REPO }}:${{ steps.version.outputs.VERSION }} + + echo "🔄 複製 latest-lite 到 Docker Hub..." + docker buildx imagetools create \ + -t ${{ env.DOCKER_IMAGE }}:latest-lite \ + ghcr.io/${{ env.REPO }}:latest-lite + + echo "✅ Docker Hub 推送完成" + + - name: Inspect images + run: | + echo "========================================" + echo "🔍 檢查 GHCR image" + echo "========================================" + docker buildx imagetools inspect 'ghcr.io/${{ env.REPO }}:${{ steps.version.outputs.VERSION }}' + + echo "" + echo "========================================" + echo "🔍 檢查 Docker Hub image" + echo "========================================" docker buildx imagetools inspect '${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.VERSION }}' # ========================================