This commit is contained in:
gxl 2026-06-03 19:06:41 +08:00
parent be16db9c0b
commit 79f2d32db0
1 changed files with 28 additions and 6 deletions

View File

@ -22,20 +22,42 @@ steps:
event: [push, pull_request] event: [push, pull_request]
branch: master branch: master
- name: 镜像构建与推送 - name: 官方标准构建与推送 (DinD)
# 👇 1. 核心:必须换成官方文档指定的 -insecure 后缀镜像
image: woodpeckerci/plugin-docker-buildx:latest-insecure image: woodpeckerci/plugin-docker-buildx:latest-insecure
volumes: privileged: true # 👈 官方 DinD 模式必须开启特权
- /var/run/docker.sock:/var/run/docker.sock
privileged: true
settings: settings:
repo: push.lovestory.cyou/abhors/demo repo: push.lovestory.cyou/abhors/demo
insecure: true # 这个是给内部 dockerd 用的
registry: push.lovestory.cyou registry: push.lovestory.cyou
insecure: true
username: username:
from_secret: nexus_docker_username from_secret: nexus_docker_username
password: password:
from_secret: nexus_docker_password from_secret: nexus_docker_password
output: type=image,push=true
# 💡 官方标准解法 1把国内加速源灌进内部的 BuildKit 编译器
# 这样它在解析 Dockerfile 里的 FROM 基础镜像时,才不会去连外网
buildkit_config: |
[registry."docker.io"]
mirrors = ["docker.1ms.run", "dockerpull.org", "1ms.run"]
[registry."push.lovestory.cyou"]
http = true
insecure = true
# 💡 官方标准解法 2把国内加速源灌进外层的 Docker 守护进程
# 这样它在第一步启动时,就能通过国内镜像秒拉 moby/buildkit绝不超时
config: |
{
"registry-mirrors": [
"https://docker.1ms.run",
"https://dockerpull.org",
"https://1ms.run"
],
"insecure-registries": [
"registry.lovestory.cyou",
"push.lovestory.cyou"
]
}
when: when:
event: push event: push
branch: master branch: master