This commit is contained in:
parent
ec232c0413
commit
c221e4b352
67
.drone.yml
Normal file
67
.drone.yml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: thief_music
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# 删除老版本
|
||||||
|
- name: deploy-clean
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: push
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: ssh_host
|
||||||
|
username:
|
||||||
|
from_secret: ssh_username
|
||||||
|
password:
|
||||||
|
from_secret: ssh_password
|
||||||
|
port: 2222
|
||||||
|
command_timeout: 2m
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
if docker ps -f name=thief_music | grep -q thief_music; then
|
||||||
|
docker stop thief_music
|
||||||
|
docker rm thief_music
|
||||||
|
else
|
||||||
|
echo "Container thief_music is not running, nothing to stop and remove."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 上传文件
|
||||||
|
- name: upload-file
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: push
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: ssh_host
|
||||||
|
username:
|
||||||
|
from_secret: ssh_username
|
||||||
|
password:
|
||||||
|
from_secret: ssh_password
|
||||||
|
port: 2222
|
||||||
|
command_timeout: 2m
|
||||||
|
target: /root/Projects/thief_music
|
||||||
|
source:
|
||||||
|
- ./*
|
||||||
|
|
||||||
|
# 部署
|
||||||
|
- name: deploy
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
when:
|
||||||
|
branch: master
|
||||||
|
event: push
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: ssh_host
|
||||||
|
username:
|
||||||
|
from_secret: ssh_username
|
||||||
|
password:
|
||||||
|
from_secret: ssh_password
|
||||||
|
port: 2222
|
||||||
|
command_timeout: 2m
|
||||||
|
script:
|
||||||
|
- cd /root/Projects/thief_music
|
||||||
|
- docker build -t thief_music .
|
||||||
|
- docker run -d --name thief_music -p 7788:7788 thief_music
|
Loading…
Reference in New Issue
Block a user