feat: .devops/helpcenter-docker.yml

This commit is contained in:
wyxttn 2026-05-13 09:24:39 +08:00 committed by jianmu
parent c742cf592d
commit f53cdf47e8
1 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,53 @@
version: 2
name: helpcenter-docker
description: "代码提交时自动构建Docker镜像并部署到服务器"
global:
concurrent: 1
trigger:
webhook: gitlink@1.0.0
event:
- ref: push
ruleset-operator: AND
workflow:
- ref: start
name: 开始
task: start
- ref: git_clone_0
name: git clone
task: git_clone@1.2.9
input:
remote_url: '"https://gitlink.org.cn/wyxttn/gitlink_help_center.git"'
ref: '"refs/heads/master"'
commit_id: '""'
depth: 1
needs:
- start
- ref: scp_resource_0
name: scp拷贝代码到服务器
task: scp_resource@1.4.3
input:
ssh_pass: ((server_ssh.password))
ssh_ip: '"121.41.212.97"'
ssh_port: '"22"'
ssh_user: '"root"'
remote_file: '"/root/gitlink_help_center"'
local_file: ((git_clone_0.git_path))
file_content: '""'
needs:
- git_clone_0
- ref: ssh_cmd_0
name: Docker构建并运行
task: ssh_cmd@1.1.1
input:
ssh_pass: ((server_ssh.password))
ssh_ip: '"121.41.212.97"'
ssh_port: '"22"'
ssh_user: '"root"'
ssh_cmd: '"cd /root/gitlink_help_center && docker build -t gitlink_help_center . && docker rm -f gitlink_help_center 2>/dev/null; docker run -d --name gitlink_help_center -p 3000:3000 gitlink_help_center"'
needs:
- scp_resource_0
- ref: end
name: 结束
task: end
needs:
- ssh_cmd_0