version: "2"
services:
  jellyfin:
    image: jellyfin/jellyfin
    container_name: jellyfin
    user: 1000:1000
    #group_add:
    #  - '109'  # This needs to be the group id of running `stat -c '%g' /dev/dri/renderD128` on the docker host
    environment:
      - TZ=Europe/London
    volumes:
      - /home/ubuntu/docker/jellyfin/config:/config
      - /home/ubuntu/docker/jellyfin/cache:/cache
      - /home/ubuntu/YOUR_NAS/Films:/Films:ro
      - /home/ubuntu/YOUR_NAS/TVShows:/TVShows:ro
      - /home/ubuntu/YOUR_NAS/Audiobooks:/Audiobooks:ro
      - /home/ubuntu/YOUR_NAS/Music:/Music:ro
    #ports: You will need to uncomment if you aren't running through a proxy
    #  - 8096:8096
    #  - 8920:8920 #optional
    #  - 7359:7359/udp #optional
    #  - 1900:1900/udp #optional
    #devices: uncomment these and amend if you require GPU accelerated transcoding
    #  - /dev/dri/renderD128:/dev/dri/renderD128
    #  - /dev/dri/card0:/dev/dri/card0
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.jellyfin.entrypoints=http"
      - "traefik.http.routers.jellyfin.rule=Host(`jellyfin.YOUR_DOMAIN.co.uk`)"
      - "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.YOUR_DOMAIN.co.uk`)"
      - "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:
    security_opt:
      - no-new-privileges:true

networks:
  proxy:
    external: true
