Files
ai-kefu-admin/docker-compose.yml
T

39 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 生产编排(Phase 4 Task 1)——单容器全栈(uvicorn 直出,无反代层时
# 8018 对外;有反代时由反代转发)。持久化全在 bind mount,容器可随手
# 重建:./tenants 挂每租户 SQLite 库;./data 挂 platform.db(租户注册表,
# P4T1 审查修复起落在 data/ 内)与 data/uploads 头像上传。
name: all-kefu
services:
app:
build: .
ports:
# 宿主侧绑定可配(生产经 .env 覆盖:APP_HOST=127.0.0.1 / APP_PORT=8019,
# 应用端口不对公网开,反代直达 127.0.0.1;容器内恒为 8018)
- "${APP_HOST:-127.0.0.1}:${APP_PORT:-8018}:8018"
env_file:
# 生产服务器放 .env(ADMIN_PASSWORD/ZHIPU_API_KEY/SMTP 等);本机
# 没有 .env 也能起(出厂默认+启动日志警示)——required: false 只是
# 容忍缺省,不改变变量优先级。注意对象式写法(path/required)需
# Docker Compose >= 2.24
- path: .env
required: false
environment:
TZ: Asia/Shanghai
volumes:
- ./data:/app/data # 头像上传等(data/uploads)
- ./tenants:/app/tenants # 每租户 SQLite 库
mem_limit: 768m
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
healthcheck:
# slim 镜像无 curl——用容器内自带的 python urllib 探 /health
# (分级 health:单租户库损坏返回 200 degraded,不杀容器)
test: ["CMD-SHELL", "python -c \"import urllib.request;urllib.request.urlopen('http://127.0.0.1:8018/health',timeout=3)\""]
interval: 30s
retries: 3
restart: unless-stopped