develop #2

Merged
Bryant merged 15 commits from develop into main 2023-07-09 05:54:34 +08:00
3 changed files with 103 additions and 4 deletions

View File

@ -1,6 +1,5 @@
# drone 会自动先拉取代码 # drone 会自动先拉取代码
# 再按顺序执行 pipeline 配置中定义的任务 # 再按顺序执行 pipeline 配置中定义的任务
---
kind: pipeline kind: pipeline
type: docker type: docker
@ -32,9 +31,10 @@ steps:
script: script:
- cd /var/www/todo - cd /var/www/todo
- git fetch - git fetch
- git checkout ${DRONE_BRANCH}
- git reset --hard ${DRONE_COMMIT} - git reset --hard ${DRONE_COMMIT}
- docker-compose down - docker-compose down
- docker-compose up -d --build - docker-compose up -d --build --force-recreate
- docker image prune -f - docker image prune -f
when: when:
event: event:
@ -42,5 +42,96 @@ steps:
- push - push
- custom - 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

View File

@ -1,5 +1,5 @@
FROM python:3.11 FROM python:3.11
WORKDIR /app #WORKDIR /app
CMD ["python3", "test.py"] # CMD ["python3", "test.py"]

View File

@ -12,4 +12,12 @@ services:
environment: environment:
TZ: "Asia/Shanghai" TZ: "Asia/Shanghai"
tty: true tty: true
working_dir: /app
command: ["python3", "test.py"]
networks:
- todo-service
networks:
todo-service:
driver: bridge