forked from Gitlink/gitlink-cli
refactor: .devops/构建部署Showcase.yml
This commit is contained in:
parent
d63ea089ba
commit
a82717bbf3
|
|
@ -1,6 +1,6 @@
|
|||
version: 2
|
||||
name: 构建部署Showcase
|
||||
description: "代码提交自动触发:构建gitlink-cli + Showcase Dashboard并部署到ECS"
|
||||
description: "代码提交自动触发:在服务器上拉取代码、构建Docker镜像并部署"
|
||||
global:
|
||||
concurrent: 1
|
||||
trigger:
|
||||
|
|
@ -12,32 +12,6 @@ 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/chroe/gitlink-cli.git"'
|
||||
ref: '"refs/heads/master"'
|
||||
commit_id: '""'
|
||||
depth: 1
|
||||
needs:
|
||||
- start
|
||||
- ref: docker_image_build_0
|
||||
name: 构建Docker镜像
|
||||
task: docker_image_build@1.6.0
|
||||
input:
|
||||
docker_username: ((aliyun_docker.docker_username))
|
||||
docker_password: ((aliyun_docker.docker_password))
|
||||
image_name: '"crpi-r6c0crt00jo9rvaq.cn-hangzhou.personal.cr.aliyuncs.com/chroe/gitlink-cli-showcase"'
|
||||
image_tag: '"latest"'
|
||||
registry_address: '"crpi-r6c0crt00jo9rvaq.cn-hangzhou.personal.cr.aliyuncs.com"'
|
||||
docker_file: '"showcase/Dockerfile"'
|
||||
docker_build_path: '"."'
|
||||
workspace: git_clone_0.git_path
|
||||
image_push: true
|
||||
build_args: '""'
|
||||
needs:
|
||||
- git_clone_0
|
||||
- ref: ssh_cmd_0
|
||||
name: SSH部署到服务器
|
||||
task: ssh_cmd@1.1.1
|
||||
|
|
@ -46,9 +20,10 @@ workflow:
|
|||
ssh_ip: '"121.41.210.165"'
|
||||
ssh_port: '"22"'
|
||||
ssh_user: '"root"'
|
||||
ssh_cmd: '"docker stop gitlink-cli-showcase || true && docker rm gitlink-cli-showcase || true && docker pull crpi-r6c0crt00jo9rvaq.cn-hangzhou.personal.cr.aliyuncs.com/chroe/gitlink-cli-showcase:latest && docker run -d -p 9090:9090 --name gitlink-cli-showcase --restart unless-stopped crpi-r6c0crt00jo9rvaq.cn-hangzhou.personal.cr.aliyuncs.com/chroe/gitlink-cli-showcase:latest"'
|
||||
ssh_cmd: >-
|
||||
"mkdir -p /opt/gitlink-cli && cd /opt/gitlink-cli && (git clone https://gitlink.org.cn/chroe/gitlink-cli.git . || git pull origin master) && docker build -f showcase/Dockerfile -t gitlink-cli-showcase . && docker stop gitlink-cli-showcase || true && docker rm gitlink-cli-showcase || true && docker run -d -p 9090:9090 --name gitlink-cli-showcase --restart unless-stopped gitlink-cli-showcase"
|
||||
needs:
|
||||
- docker_image_build_0
|
||||
- start
|
||||
- ref: end
|
||||
name: 结束
|
||||
task: end
|
||||
|
|
|
|||
Loading…
Reference in New Issue