修改了基于docker 一键部署的Dockerfile 和dockercompose.yaml
This commit is contained in:
@@ -8,6 +8,8 @@ WORKDIR /app/
|
||||
|
||||
ENV TIME_ZONE Asia/Shanghai
|
||||
|
||||
RUN chmod +x /app/start.sh
|
||||
RUN echo "${TIME_ZONE}" > /etc/timezone \
|
||||
&& ln -sf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \
|
||||
&& chmod +x /app/start.sh
|
||||
|
||||
CMD ./start.sh
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
version: '3'
|
||||
services:
|
||||
mysql:
|
||||
image: "mysql:5.7"
|
||||
container_name: mysql
|
||||
restart: always
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- "./dockerdata/mysql/data:/var/lib/mysql"
|
||||
- "./dockerdata/mysql/initdb:/docker-entrypoint-initdb.d"
|
||||
environment:
|
||||
LANG: C.UTF-8
|
||||
TZ: Asia/Shanghai
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
networks:
|
||||
flask-network:
|
||||
ipv4_address: 172.10.1.31
|
||||
|
||||
flask:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.server
|
||||
container_name: flask
|
||||
restart: always
|
||||
ports:
|
||||
- "8000:8000"
|
||||
depends_on:
|
||||
- mysql
|
||||
networks:
|
||||
flask-network:
|
||||
ipv4_address: 172.10.1.11
|
||||
|
||||
networks:
|
||||
flask-network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.10.0.0/16
|
||||
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
import multiprocessing
|
||||
|
||||
bind = '0.0.0.0:8000'
|
||||
backlog = 512
|
||||
chdir = os.path.dirname(os.path.abspath(__file__))
|
||||
timeout = 30
|
||||
worker_class = 'sync'
|
||||
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
threads = 2
|
||||
loglevel = 'info'
|
||||
access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'
|
||||
|
||||
if not os.path.exists('logs'):
|
||||
os.mkdir('logs')
|
||||
|
||||
accesslog = os.path.join(chdir, "logs/gunicorn_access.log")
|
||||
errorlog = os.path.join(chdir, "logs/gunicorn_error.log")
|
||||
Reference in New Issue
Block a user