From d45ca9afe22cb0fcd53ec2021ba43fe43daf6099 Mon Sep 17 00:00:00 2001 From: lan Date: Tue, 2 Dec 2025 11:47:51 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0Docker=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=EF=BC=8C=E5=88=87=E6=8D=A2=E5=88=B0Alpine?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E9=95=9C=E5=83=8F=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=AE=89=E8=A3=85=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/docker.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index 641f72c..e5cfe7f 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -18,15 +18,24 @@ jobs: build-and-push: runs-on: ubuntu-latest container: - image: gcr.io/kaniko-project/executor:debug - options: --entrypoint "" + image: alpine:3.19 steps: + - name: Install dependencies + run: | + apk add --no-cache curl git bash + - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Download Kaniko + run: | + mkdir -p /kaniko + curl -L https://github.com/GoogleContainerTools/kaniko/releases/download/v1.23.2/executor-linux-amd64 -o /kaniko/executor + chmod +x /kaniko/executor + - name: Create registry config run: | mkdir -p /kaniko/.docker @@ -40,11 +49,10 @@ jobs: } } EOF - echo "Registry config created" + echo "Registry config created for ${{ env.REGISTRY }}" - name: Build and push image run: | - # 获取短 SHA SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) REF_NAME="${{ github.ref_name }}" REF="${{ github.ref }}" @@ -65,14 +73,11 @@ jobs: --context "${GITHUB_WORKSPACE}" \ --dockerfile "${GITHUB_WORKSPACE}/Dockerfile" \ $DESTINATIONS \ - --cache=true \ - --cache-repo=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/cache \ - --snapshot-mode=redo \ - --use-new-run + --cache=false \ + --snapshot-mode=redo - name: Build complete run: | echo "✅ 镜像构建完成!" echo "仓库: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}" echo "分支: ${{ github.ref_name }}" - echo "提交: ${{ github.sha }}"