签入版本
This commit is contained in:
+17
-11
@@ -1,6 +1,13 @@
|
||||
# +======================================================================
|
||||
# | 模块: Docker Compose 配置
|
||||
# | 说明: FastAPI+EleVue 应用服务容器编排
|
||||
# +======================================================================
|
||||
|
||||
version: '3.7'
|
||||
|
||||
# ============================================================
|
||||
# 应用服务
|
||||
# ============================================================
|
||||
services:
|
||||
# 后端服务
|
||||
fastapi_elevue:
|
||||
@@ -12,27 +19,26 @@ services:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile
|
||||
#build: .
|
||||
# 将容器运行在特权模式下,意味着容器内的进程将具
|
||||
# 有访问宿主机的权限,包括文件系统、设备和系统功能等
|
||||
privileged: true
|
||||
# 指定容器中运行的用户
|
||||
user: root
|
||||
# 启动策略为始终重启
|
||||
# 启动策略:始终重启
|
||||
restart: always
|
||||
# 设置网络模式为host模式
|
||||
# 网络模式:host 模式(DB_HOST/REDIS_HOST 为 127.0.0.1 时可直接连通宿主机)
|
||||
# 注意:host 模式下 ports 映射会被忽略;若改为 bridge 网络,
|
||||
# 需将 DB_HOST/REDIS_HOST 指向宿主机(如 host.docker.internal)并启用端口映射
|
||||
network_mode: host
|
||||
# 端口映射
|
||||
# 端口映射(仅在 bridge 网络模式下生效)
|
||||
ports:
|
||||
- 8031:8031
|
||||
# 文件挂载
|
||||
volumes:
|
||||
- ./uploads:/data/apps/uploads
|
||||
# 环境变量注入:从宿主机 .env 读取并注入容器进程
|
||||
env_file:
|
||||
- .env
|
||||
# 执行命令
|
||||
command: python main.py runserver 0.0.0.0:8031 --noreload
|
||||
command: python src/main.py
|
||||
# 日志配置
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "500m"
|
||||
max-file: "10"
|
||||
max-file: "10"
|
||||
Reference in New Issue
Block a user