version: "3.9"
services:
  media:
    image: nginx:1.27-alpine
    restart: unless-stopped
    container_name: mindboost-media-server
    volumes:
      - ./nginx/html:/usr/share/nginx/html:ro
      - ./nginx/conf.d:/etc/nginx/conf.d:ro

    labels:
      # ——— Traefik v2 path-based routing ———
      - traefik.enable=true

      # Route: https://b.mindboost.team/media  (optionally with /anything/after/that)
      - traefik.http.routers.media.rule=Host(`b.mindboost.team`) && Path(`/{path:.*\\.(mp3|aac|m4a|ogg|opus|flac|wav)$}`)

      # TLS via the proxys “websecure” entrypoint
      - traefik.http.routers.media.entrypoints=websecure
      - traefik.http.routers.media.tls.certresolver=http_resolver

      # Upstream container port
      - traefik.http.services.media.loadbalancer.server.port=80

    networks:
      - proxy
networks:
  proxy:
    external: true
