# 测试/正式环境部署编排(正式口令不得写入本文件)。 # 使用:复制 .env.example 为 .env 填写;TAG 指定镜像标签(默认取当前提交 sha)。 # 例:TAG=v1.0.0-rc1 docker compose -f compose.yaml up -d --build services: app: container_name: caiwuzongzhang-app image: caiwuzongzhang:${TAG:-latest} build: context: .. dockerfile: deploy/Dockerfile env_file: - .env # 绑定挂载 data/ 时,容器运行 uid 必须与数据目录属主一致(.env 里设 # APP_UID/APP_GID,正式与测试环境各自填写,默认镜像内 app=10001) user: "${APP_UID:-10001}:${APP_GID:-10001}" ports: - "4173:4173" volumes: - ../data:/app/data init: true restart: unless-stopped read_only: true tmpfs: - /tmp:size=64m,mode=1777 security_opt: - no-new-privileges:true cap_drop: - ALL pids_limit: 128 mem_limit: 512m cpus: 1.0 healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:4173/', timeout=2)"] interval: 15s timeout: 3s retries: 5 start_period: 10s