Files
FastapiAdmin/build/docker-compose.yaml
T
2024-12-10 17:39:26 +08:00

72 lines
1.5 KiB
YAML

version: "3.10.11"
# 应用服务
services:
# 应用服务
fastapi_getway:
# 容器名称
container_name: fastapi
# 镜像名称
image: fastapi
env_file: .env
networks:
- db_network
- web_network
# 构建镜像
build:
context: ./
dockerfile: Dockerfile
#build: .
# 将容器运行在特权模式下,意味着容器内的进程将具
# 有访问宿主机的权限,包括文件系统、设备和系统功能等
privileged: true
# 指定容器中运行的用户
user: root
# 启动策略为始终重启
restart: always
# 设置网络模式为host模式
network_mode: host
# 端口映射
ports:
- 8020:8020
# 文件挂载
volumes:
- ./:/data/apps
- ./uploads:/data/apps/uploads
# 执行命令
command: python app.py runserver 0.0.0.0:8020 --noreload
# 日志配置
logging:
driver: "json-file"
options:
max-size: "500m"
max-file: "10"
# nginx服务
nginx:
container_name: nginx
restart: always
image: "nginx:latest"
ports:
- "5000:5000"
volumes:
- ./nginx:/etc/nginx/conf.d
networks:
- web_network
depends_on:
- flask_api
# 中间件服务
mysql:
container_name: mysql
image: mysql:latest
restart: always
ports:
- "3306:3306"
# 数据卷挂载
networks:
db_network:
driver: bridge
web_network:
driver: bridge