version: "3.5"
services:
  jellyfin:
    image: docker.io/jellyfin/jellyfin
    container_name: jellyfin
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true

    # stdin_open: true # docker run -i
    # tty: true # docker run -t
    # network_mode: "host"
    networks:
      - proxy
    # user: uid:gid
    ports:
      - 0.0.0.0:8096:8096
    volumes:
      - /tank/jellyfin/config:/config
      - /tank/jellyfin/cache:/cache
      - /mnt/vault/:/media
      - /tank/jellyfin/media:/media2:ro
    # Optional - alternative address used for autodiscovery
    environment:
      - JELLYFIN_PublishedServerUrl=https://jellyfin.${URL}
    # Optional - may be necessary for docker healthcheck to pass if running in host network mode
    # extra_hosts:
    #   - "host.docker.internal:host-gateway"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.jellyfin.entrypoints=http"
      - "traefik.http.routers.jellyfin.rule=Host(`jellyfin.${URL}`)"
      - "traefik.http.middlewares.jellyfin-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.jellyfin.middlewares=jellyfin-https-redirect"
      - "traefik.http.routers.jellyfin-secure.entrypoints=https"
      - "traefik.http.routers.jellyfin-secure.rule=Host(`jellyfin.${URL}`)"
      - "traefik.http.routers.jellyfin-secure.tls=true"
      - "traefik.http.routers.jellyfin-secure.service=jellyfin"
      - "traefik.http.services.jellyfin.loadbalancer.server.port=8096"
      - "traefik.docker.network=proxy"
networks:
  proxy:
    external: true
