version: '3.8'
services:
  aps-ui:
    build:
      context: /volume1/social_media_bridge/aps-ui
      dockerfile: Dockerfile
    image: aps-ui:latest
    container_name: aps-ui
    restart: unless-stopped
    # WHAT: Share the NAS host network stack instead of using Docker bridge networking
    # WHY: Lets the container reach DSM on localhost:5000 directly, bypassing any
    #      bridge routing or firewall rules that block Docker → DSM connections.
    #      With host networking the app is accessible at NAS_IP:3001 (WEB_PORT).
    network_mode: host
    env_file:
      - /volume1/social_media_bridge/aps-ui/.env
    environment:
      SYNOLOGY_NAS_ROOT: /media
      UI_SLUG_MAP_PATH: /run/ui-slug-map.json
    volumes:
      - /volume1/social_media_bridge:/media:rw
      - /volume1/social_media_bridge/aps-ui/ui-slug-map.json:/run/ui-slug-map.json:ro
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:3001/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 15s
