代码拉取完成,页面将自动刷新
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
container_name: "fa_redis"
networks:
- redis_network
expose:
- "6379"
volumes:
- redis_vol:/data
restart: always
mysql:
image: mysql:8.0.27
container_name: "fa_mysql"
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
container_name: "fa_nginx"
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
image: fastapi:demo
container_name: "fa_demo"
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' ]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。