From 6bb86420284cad93c0d762a8a2fbf5e96fbe0256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E6=A3=AE?= Date: Wed, 1 Dec 2021 14:36:30 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=8A=E4=BC=A0=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 14 ++++++++++++++ Dockerfile | 6 ++++++ gunicorn.conf.py | 8 ++++++++ requirements.txt | 5 +++++ setting.py | 2 +- 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile create mode 100644 gunicorn.conf.py create mode 100644 requirements.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8c6933f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,14 @@ +stages: + - deploy + +job: + stage: deploy + script: +# - docker stop service_tyc +# - docker rm service_tyc + - docker build -t service_tyc . + - docker run -d -p 51011:51011 --name service_tyc -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro service_tyc + only: + - master + tags: + - service_tyc diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..774986a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.8 +WORKDIR /usr/src/app/service_tyc +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"] \ No newline at end of file diff --git a/gunicorn.conf.py b/gunicorn.conf.py new file mode 100644 index 0000000..5e52a68 --- /dev/null +++ b/gunicorn.conf.py @@ -0,0 +1,8 @@ +from setting import APP_PORT + +# 并行工作进程数 +workers = 10 +# 监听内网端口 +bind = '0.0.0.0:{}'.format(APP_PORT) +# 工作模式协程 +worker_class = 'gevent' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b7adac5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +flask~=1.1.2 +flask_cors +gunicorn +gevent +pymongo~=3.11.3 \ No newline at end of file diff --git a/setting.py b/setting.py index 2eb9abd..e0e41eb 100644 --- a/setting.py +++ b/setting.py @@ -1,5 +1,5 @@ PROJECT_NAME = 'tfse_tyc' -PROJECT_PORT = '60006' +APP_PORT = '51011' # 数据库配置(tyc) DB_HOST = '116.63.130.34'