1 Star 0 Fork 19

Ozhas/fastapi_demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
docker-compose.prod.yml 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
暗影之风暴R 提交于 2022-08-17 21:51 . 调整nginx日志的挂载方式
version: "3"
volumes: # 自定义数据卷
mysql_vol:
redis_vol:
media_vol:
networks:
nginx_network:
driver: bridge
mysql_network:
driver: bridge
redis_network:
driver: bridge
services:
redis:
image: redis:6.2.7
networks:
- redis_network
expose:
- "6379"
volumes:
- redis_vol:/data
restart: always
mysql:
image: mysql:8.0.27
environment:
LANG: C.UTF-8
MYSQL_ROOT_PASSWORD: "123456"
MYSQL_DATABASE: "fa_demo"
networks:
- mysql_network
volumes:
- ./deploy/mysql/init:/docker-entrypoint-initdb.d/ # 挂载数据初始化sql脚本
- mysql_vol:/var/lib/mysql:rw # 挂载数据库数据, 可读可写
- mysql_vol:/var/lib/mysql-files:rw # 挂载数据库数据, 可读可写
expose:
- "3306"
restart: always
command:
- "mysqld"
- "--default-authentication-plugin=mysql_native_password"
- "--bind-address=0.0.0.0"
- "--mysqlx-bind-address=0.0.0.0"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
nginx:
image: nginx:1.18.0
ports:
- "33333:80" # 前一个是宿主机端口,可以远程,后一个是容器内端口,只是容器之间使用的
volumes:
- ./deploy/nginx/nginx.conf:/etc/nginx/conf.d/default.conf # 挂载nginx配置文件
- ./logs/nginx_access.log:/var/log/nginx/nginx_access.log # 日志文件
- ./logs/nginx_error.log:/var/log/nginx/nginx_error.log # 日志文件
- ./static:/usr/share/nginx/html/static # 挂载静态文件
- ./dist:/usr/share/nginx/html/dist # 前端打包好的文件
- media_vol:/usr/share/nginx/html/media # 挂载用户上传媒体文件
networks:
- nginx_network
depends_on:
- fastapi
restart: always
fastapi:
build:
context: .
dockerfile: ./deploy/python/Dockerfile
volumes:
- ./logs:/app/logs
- media_vol:/app/media
- ./static:/app/static
expose:
- "8000"
environment:
PROJECT_ENV: "prod"
networks:
- nginx_network
- mysql_network
- redis_network
depends_on:
- mysql
- redis
restart: always
entrypoint: [ 'gunicorn','-c','./deploy/gunicorn.conf.py' ]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ozhas/fastapi_demo.git
[email protected]:ozhas/fastapi_demo.git
ozhas
fastapi_demo
fastapi_demo
master

搜索帮助