2021-01-20 14:54:41 +08:00
|
|
|
#pipeline
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
2020-07-24 17:34:03 +08:00
|
|
|
steps:
|
2021-01-20 14:54:41 +08:00
|
|
|
# 构建Docker镜像并推送到仓库
|
|
|
|
# 定义镜像Hub路径以及账号密码
|
|
|
|
- name: Docker镜像构建
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
username: username
|
|
|
|
password: pwd
|
|
|
|
repo: repoUrl
|
|
|
|
tags: latest
|
|
|
|
- name: golang编译
|
|
|
|
image: golang
|
|
|
|
commands:
|
|
|
|
- go build
|
|
|
|
# 根据实际情况修改主机ip、账号、密码
|
|
|
|
# 需要将软件包与部署脚本提前上传到远程主机(见文件上传模板)
|
|
|
|
|
|
|
|
- name: 远程主机部署
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
settings:
|
|
|
|
host: 192.168.1.1
|
|
|
|
username: username
|
|
|
|
password: 'pasword'
|
|
|
|
port: 22
|
|
|
|
commands:
|
|
|
|
- chmod +x /home/deploy.sh
|
|
|
|
- ./home/deploy.sh
|