# ================================================
# Urban Lifeline - All-in-One 前端部署
# 单容器运行所有前端应用
# ================================================

services:
  urban-lifeline-web:
    image: urban-lifeline-web:${IMAGE_VERSION:-latest}
    container_name: urban-lifeline-web
    restart: unless-stopped
    env_file:
      - .env
    networks:
      - urban-lifeline
    # 不对外暴露端口，仅通过 nginx 反向代理访问
    expose:
      - "8000"
      - "8001"
      - "8002"
      - "8003"
      - "8004"
    environment:
      TZ: Asia/Shanghai
      SHARED_PORT: ${SHARED_PORT:-8000}
      PLATFORM_PORT: ${PLATFORM_PORT:-8001}
      WORKCASE_PORT: ${WORKCASE_PORT:-8002}
      BIDDING_PORT: ${BIDDING_PORT:-8003}
      WORKCASE_WECHAT_PORT: ${WORKCASE_WECHAT_PORT:-8004}
    volumes:
      # 配置文件目录 (app-config-*.js)
      - ${CONFIG_ROOT:-./config}:/app/config:ro
      # 日志目录
      - ${LOG_ROOT:-./volumes/logs}:/app/logs
      # 数据目录 (静态资源等)
      - ${DATA_ROOT:-./volumes/data}:/app/data
    deploy:
      resources:
        limits:
          memory: ${MEMORY_LIMIT:-512M}
        reservations:
          memory: ${MEMORY_RESERVATION:-128M}
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s

networks:
  urban-lifeline:
    name: urban-lifeline
