services: xiangcai-status: # 默认拉取 CI 构建好的镜像;未设置 XIANGCAI_IMAGE 时使用本地镜像 / 本地构建。 image: ${XIANGCAI_IMAGE:-xiangcai-status:local} # 由 docker compose up --build 或旧版本的 docker compose up 触发本地构建; # docker compose pull && up -d 只拉取镜像,不会重新构建。 build: context: . target: runtime restart: unless-stopped init: true env_file: - .env environment: # Container networking must not inherit the development HOST / PORT values. NODE_ENV: production HOST: 0.0.0.0 PORT: "3001" ports: - "${DOCKER_BIND_ADDRESS:-0.0.0.0}:${DOCKER_PORT:-3001}:3001" volumes: # 只覆盖两个源文件:镜像里还没有 EMO_ACCESS_TOKEN 支持时,挂上这两份就能用 # (emo.js 负责发 token 头,index.js 负责把 .env 的值传进去); # 镜像以后更新到该版本,目录依然存在,挂载继续有效(内容与镜像一致)。 - ./server/emo.js:/app/server/emo.js:ro - ./server/index.js:/app/server/index.js:ro extra_hosts: - "host.docker.internal:host-gateway" read_only: true security_opt: - no-new-privileges:true cap_drop: - ALL stop_grace_period: 30s logging: driver: local options: max-size: "10m" max-file: "3"