develop #2
95
.drone.yml
95
.drone.yml
|
@ -1,6 +1,5 @@
|
|||
# drone 会自动先拉取代码
|
||||
# 再按顺序执行 pipeline 配置中定义的任务
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
|
@ -32,9 +31,10 @@ steps:
|
|||
script:
|
||||
- cd /var/www/todo
|
||||
- git fetch
|
||||
- git checkout ${DRONE_BRANCH}
|
||||
- git reset --hard ${DRONE_COMMIT}
|
||||
- docker-compose down
|
||||
- docker-compose up -d --build
|
||||
- docker-compose up -d --build --force-recreate
|
||||
- docker image prune -f
|
||||
when:
|
||||
event:
|
||||
|
@ -42,5 +42,96 @@ steps:
|
|||
- push
|
||||
- custom
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: develop
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
include:
|
||||
- develop
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
- name: deploy
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
from_secret: host
|
||||
username: root
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
port: 22
|
||||
script_stop: true
|
||||
script:
|
||||
- cd /var/www/todo
|
||||
- git fetch
|
||||
- git checkout ${DRONE_BRANCH}
|
||||
- git reset --hard ${DRONE_COMMIT}
|
||||
- docker-compose down
|
||||
- docker-compose up -d --build --force-recreate
|
||||
- docker image prune -f
|
||||
when:
|
||||
event:
|
||||
include:
|
||||
- pull_request
|
||||
action:
|
||||
include:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronized
|
||||
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: main-pull-request-staging
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
include:
|
||||
- main
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
- name: deploy
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
from_secret: host
|
||||
username: root
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
port: 22
|
||||
script_stop: true
|
||||
script:
|
||||
- cd /var/www/todo
|
||||
- git fetch
|
||||
- git checkout ${DRONE_BRANCH}
|
||||
- git reset --hard ${DRONE_COMMIT}
|
||||
- docker-compose down
|
||||
- docker-compose up -d --build --force-recreate
|
||||
- docker image prune -f
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
action:
|
||||
include:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronized
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
FROM python:3.11
|
||||
|
||||
WORKDIR /app
|
||||
#WORKDIR /app
|
||||
|
||||
CMD ["python3", "test.py"]
|
||||
# CMD ["python3", "test.py"]
|
|
@ -12,4 +12,12 @@ services:
|
|||
environment:
|
||||
TZ: "Asia/Shanghai"
|
||||
tty: true
|
||||
working_dir: /app
|
||||
command: ["python3", "test.py"]
|
||||
networks:
|
||||
- todo-service
|
||||
|
||||
networks:
|
||||
todo-service:
|
||||
driver: bridge
|
||||
|
||||
|
|
Loading…
Reference in New Issue