refactor: 更新Docker工作流,切换到Alpine基础镜像并添加依赖安装步骤
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 10s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 10s
This commit is contained in:
@@ -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 }}"
|
||||
|
||||
Reference in New Issue
Block a user