version: '3.8'

services:
  # 数字档案管理系统前端服务
  digital-archive-frontend:
    image: ${IMAGE_NAME:-digital-archive-frontend}:${IMAGE_TAG:-latest}
    container_name: ${CONTAINER_NAME:-digital-archive-frontend}
    ports:
      - "${HOST_PORT:-80}:80"
    networks:
      - ${NETWORK_NAME:-proxy}
    restart: ${RESTART_POLICY:-unless-stopped}
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.${CONTAINER_NAME:-digital-archive-frontend}.rule=Host(`${DOMAIN_NAME:-localhost}`)"
      - "traefik.http.routers.${CONTAINER_NAME:-digital-archive-frontend}.entrypoints=web"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

networks:
  proxy:
    external: ${EXTERNAL_NETWORK:-true}
    name: ${NETWORK_NAME:-proxy}
