chore: add drone yml
continuous-integration/drone/push Build is passing Details

This commit is contained in:
BryantHe 2023-08-11 16:39:20 +08:00
parent fb46ba4395
commit a7f3479fcf
1 changed files with 58 additions and 0 deletions

58
.drone.yml Normal file
View File

@ -0,0 +1,58 @@
# drone 会按顺序执行 pipeline 配置中定义的任务
# main 分支在 build 和 PR 时执行的 pipeline
kind: pipeline
type: docker
name: main-pipeline
platform:
os: linux
arch: amd64
trigger:
branch:
include:
- main
event:
include:
- custom
- push
clone:
disable: true
steps:
- name: deploy-k8s-master
image: appleboy/drone-ssh
settings:
host:
from_secret: k8s_master
username: ubuntu
key:
from_secret: k8s_key
port: 22
script_stop: true
script:
- cd /var/www/pzx-web-api
- sudo git fetch
- sudo git reset --hard ${DRONE_COMMIT}
- sudo docker-compose down
- sudo docker-compose up -d --build --force-recreate
- sudo docker image prune -f
- name: deploy-k8s-worker
image: appleboy/drone-ssh
settings:
host:
from_secret: k8s_worker
username: ubuntu
key:
from_secret: k8s_key
port: 22
script_stop: true
script:
- cd /var/www/pzx-web-api
- sudo git fetch
- sudo git reset --hard ${DRONE_COMMIT}
- sudo docker-compose down
- sudo docker-compose up -d --build --force-recreate
- sudo docker image prune -f