运维配置

This commit is contained in:
王思川 2021-12-01 01:24:35 +08:00
parent e7cf14d19d
commit 381b8857ec
4 changed files with 29 additions and 1 deletions

14
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,14 @@
stages:
- deploy
job:
stage: deploy
script:
# - docker stop tfse_app_api
# - docker rm tfse_app_api
- docker build -t tfse_app_api .
- docker run -d -p 51020:51020 --name tfse_app_api -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro tfse_app_api
only:
- master
tags:
- tfse_app_api

6
Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM python:3.8
WORKDIR /usr/src/app/tfse_app_api
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.mirrors.ustc.edu.cn/simple
COPY . .
CMD ["gunicorn", "app:app", "-c", "./gunicorn.conf.py"]

8
gunicorn.conf.py Normal file
View File

@ -0,0 +1,8 @@
from setting import APP_PORT
# 并行工作进程数
workers = 10
# 监听内网端口
bind = '0.0.0.0:{}'.format(APP_PORT)
# 工作模式协程
worker_class = 'gevent'

View File

@ -1,3 +1,3 @@
# 应用配置 # 应用配置
APP_NAME = 'tfse_app_api' APP_NAME = 'tfse_app_api'
APP_PORT = '' APP_PORT = 51020