refactor: 更新Docker工作流,切换到Node基础镜像并优化依赖安装和构建输出
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m15s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1m15s
This commit is contained in:
@@ -18,12 +18,13 @@ jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: alpine:3.19
|
||||
image: node:20-bookworm # Debian 镜像,包含完整工具链
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apk add --no-cache curl git bash
|
||||
apt-get update
|
||||
apt-get install -y curl git ca-certificates
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -35,6 +36,7 @@ jobs:
|
||||
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
|
||||
echo "Kaniko 下载完成"
|
||||
|
||||
- name: Create registry config
|
||||
run: |
|
||||
@@ -49,7 +51,7 @@ jobs:
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo "Registry config created for ${{ env.REGISTRY }}"
|
||||
echo "Registry 认证配置完成: ${{ env.REGISTRY }}"
|
||||
|
||||
- name: Build and push image
|
||||
run: |
|
||||
@@ -66,7 +68,10 @@ jobs:
|
||||
DESTINATIONS="$DESTINATIONS --destination=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
|
||||
fi
|
||||
|
||||
echo "构建目标: $DESTINATIONS"
|
||||
echo "=============================="
|
||||
echo "开始构建 Docker 镜像"
|
||||
echo "目标: $DESTINATIONS"
|
||||
echo "=============================="
|
||||
|
||||
# 使用 Kaniko 构建并推送
|
||||
/kaniko/executor \
|
||||
@@ -76,8 +81,11 @@ jobs:
|
||||
--cache=false \
|
||||
--snapshot-mode=redo
|
||||
|
||||
- name: Build complete
|
||||
- name: Build summary
|
||||
run: |
|
||||
echo "=============================="
|
||||
echo "✅ 镜像构建完成!"
|
||||
echo "仓库: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
|
||||
echo "分支: ${{ github.ref_name }}"
|
||||
echo "提交: ${{ github.sha }}"
|
||||
echo "=============================="
|
||||
|
||||
Reference in New Issue
Block a user