version: '3.8'
services:
  web:
    image: nginx:alpine
    container_name: insta_nginx
    volumes:
      - "/volume1/photo/Sk8ne Shared:/usr/share/nginx/html:ro"
    ports:
      - "5556:80"
    restart: always

  universal-bridge:
    image: nginx:alpine
    container_name: universal-media-bridge
    command: /bin/sh -c "echo 'server { listen 80; location / { root /usr/share/nginx/html; autoindex on; } }' > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
    volumes:
      - "/volume1/social_media_bridge:/usr/share/nginx/html:ro"
    ports:
      - "5558:80"
    restart: always

  aps-ui:
    build:
      context: /volume1/social_media_bridge/aps-ui
      dockerfile: Dockerfile
    image: aps-ui:latest
    container_name: aps-ui
    restart: unless-stopped
    ports:
      - "3100:3001"
    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