Compare commits
23 Commits
2e7766631f
...
v0.1.0
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 |
141
.drone.yml
141
.drone.yml
@@ -1,6 +1,5 @@
|
|||||||
# drone 会自动先拉取代码
|
# drone 会自动先拉取代码
|
||||||
# 再按顺序执行 pipeline 配置中定义的任务
|
# 再按顺序执行 pipeline 配置中定义的任务
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
@@ -14,6 +13,10 @@ trigger:
|
|||||||
branch:
|
branch:
|
||||||
include:
|
include:
|
||||||
- feature/*
|
- feature/*
|
||||||
|
event:
|
||||||
|
include:
|
||||||
|
- push
|
||||||
|
- custom
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
disable: true
|
disable: true
|
||||||
@@ -32,15 +35,139 @@ 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
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: develop
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
include:
|
||||||
|
- develop
|
||||||
|
event:
|
||||||
|
include:
|
||||||
|
- push
|
||||||
|
|
||||||
|
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
|
- docker image prune -f
|
||||||
when:
|
|
||||||
event:
|
|
||||||
include:
|
|
||||||
- push
|
|
||||||
- custom
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
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 更新镜像
|
@@ -2,4 +2,8 @@ FROM python:3.11
|
|||||||
|
|
||||||
WORKDIR /app
|
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"]
|
4
app.py
Normal file
4
app.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from apiflask import APIFlask
|
||||||
|
|
||||||
|
app = APIFlask(__name__)
|
||||||
|
app.run()
|
@@ -12,4 +12,12 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
TZ: "Asia/Shanghai"
|
TZ: "Asia/Shanghai"
|
||||||
tty: true
|
tty: true
|
||||||
|
networks:
|
||||||
|
- todo-service
|
||||||
|
ports:
|
||||||
|
- "5010:5000"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
todo-service:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
apiflask>=1.3.1
|
Reference in New Issue
Block a user