refactor(ci): 优化 Woodpecker CI 配置
- 移除 Maven 缓存卷挂载配置 - 更新 Docker 构建步骤为镜像构建与推送 - 使用 plugins/docker 插件简化 Docker 操作 - 添加条件触发规则仅在 main 分支 push 时执行 - 注释说明 plugins/docker 插件权限配置要求
This commit is contained in:
parent
cc3a740993
commit
1d3b08c306
|
|
@ -5,19 +5,14 @@ steps:
|
|||
pull: true
|
||||
commands:
|
||||
- mvn clean package -DskipTests
|
||||
# volumes 挂载在单工作流中可正常使用
|
||||
# 注意:使用 volumes 必须在 Web UI 中开启 "Trusted" 权限
|
||||
volumes:
|
||||
- /tmp/maven-cache:/root/.m2
|
||||
when:
|
||||
event: [push, pull_request]
|
||||
branch: main
|
||||
|
||||
- name: Docker 构建
|
||||
image: docker:latest
|
||||
pull: true
|
||||
commands:
|
||||
- docker build -t registry.cn-zhangjiakou.aliyuncs.com/abhors/demo:latest .
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
- name: 镜像推送
|
||||
- name: 镜像构建与推送
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: registry.cn-zhangjiakou.aliyuncs.com/abhors/demo
|
||||
|
|
@ -26,4 +21,9 @@ steps:
|
|||
username:
|
||||
from_secret: aliyun_acr_username
|
||||
password:
|
||||
from_secret: aliyun_acr_password
|
||||
from_secret: aliyun_acr_password
|
||||
# 很多时候 plugins/docker 内部默认会处理 context,不需要你手动挂载 docker.sock
|
||||
# 但需要确保服务器配置了 WOODPECKER_PLUGINS_PRIVILEGED=plugins/docker
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
Loading…
Reference in New Issue