Compare commits
23
Commits
2e7766631f
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
043e9fbfac | ||
|
|
c22fac8b81 | ||
|
|
97663dc942 | ||
|
|
5b6090e88d | ||
|
|
e86cd394c5 | ||
|
|
56f86e0df0 | ||
|
|
cfb22f64b5 | ||
|
|
ac0f8be867 | ||
|
|
7e3fe00605 | ||
|
|
b5ecdc9eef | ||
|
|
da5b84e5c9 | ||
|
|
8ea68aabfe | ||
|
|
ce40570c93 | ||
|
|
97e61f1007 | ||
|
|
07749c709e | ||
|
|
6fa57028dd | ||
|
|
530d52fddd | ||
|
|
acf13bb6b8 | ||
|
|
8e0d7d13de | ||
|
|
e198e15699 | ||
|
|
86eaff16b0 | ||
|
|
664d7aa60d | ||
|
|
186d639ce2 |
+131
-4
@@ -1,6 +1,5 @@
|
||||
# drone 会自动先拉取代码
|
||||
# 再按顺序执行 pipeline 配置中定义的任务
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
@@ -14,6 +13,10 @@ trigger:
|
||||
branch:
|
||||
include:
|
||||
- feature/*
|
||||
event:
|
||||
include:
|
||||
- push
|
||||
- custom
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
@@ -32,15 +35,139 @@ 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:
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: develop
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
include:
|
||||
- develop
|
||||
event:
|
||||
include:
|
||||
- push
|
||||
- custom
|
||||
|
||||
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
|
||||
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: main-pull-request-staging
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
include:
|
||||
- main
|
||||
event:
|
||||
- pull_request
|
||||
action:
|
||||
include:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronized
|
||||
|
||||
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
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: main-tag-prod
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
event:
|
||||
include:
|
||||
- tag
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
steps:
|
||||
- name: clone-repo
|
||||
image: alpine/git
|
||||
commands:
|
||||
- git clone ${DRONE_GIT_HTTP_URL} .
|
||||
- git checkout ${DRONE_BRANCH}
|
||||
- name: build-and-push-image
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry:
|
||||
from_secret: docker_registry
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: gitea.bearcatlog.com/bryant/todo
|
||||
context: .
|
||||
dockerfile: ./Dockerfile
|
||||
tags:
|
||||
- ${DRONE_TAG}
|
||||
purge: true
|
||||
compress: true
|
||||
|
||||
|
||||
# TODO 通知 k8s 更新镜像
|
||||
+5
-1
@@ -2,4 +2,8 @@ FROM python:3.11
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
CMD ["python3", "test.py"]
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN python3 -m pip install -i https://mirrors.cloud.tencent.com/pypi/simple --trusted-host=mirrors.cloud.tencent.com -r requirements.txt
|
||||
|
||||
CMD ["python3", "app.py"]
|
||||
@@ -0,0 +1,4 @@
|
||||
from apiflask import APIFlask
|
||||
|
||||
app = APIFlask(__name__)
|
||||
app.run()
|
||||
@@ -12,4 +12,12 @@ services:
|
||||
environment:
|
||||
TZ: "Asia/Shanghai"
|
||||
tty: true
|
||||
networks:
|
||||
- todo-service
|
||||
ports:
|
||||
- "5010:5000"
|
||||
|
||||
networks:
|
||||
todo-service:
|
||||
driver: bridge
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
apiflask>=1.3.1
|
||||
Reference in New Issue
Block a user