services:
  qbittorrent:
    extends:
      file: ${TEMPLATES_PATH}
      service: default
    image: lscr.io/linuxserver/qbittorrent:5.1.4
    container_name: qbittorrent
    ports:
      - 2002:2002
      - 50059:6881
      - 50059:6881/udp
    networks:
      - ip4net
      - ip6net
    environment:
      - WEBUI_PORT=2002
      - TORRENTING_PORT=50059
    volumes:
      - ${MEDIA_PATH}/qbittorrent/config:/config
      - ${MEDIA_PATH}/data/torrents:/data/torrents
      - ${MEDIA_PATH}/data/downloaded/books:/data/downloaded/books
      - ${EXTERNAL_STORAGE}/media/audiobooks:/data/downloaded/audiobooks
      - ${EXTERNAL_STORAGE}/media/music:/data/downloaded/music
    labels:
      # Traefik
      - "traefik.enable=true"
      - "traefik.http.routers.qbittorrent.rule=Host(`qbittorrent.${LOCAL_DOMAIN}`)"
      - "traefik.http.routers.qbittorrent.entrypoints=https"
      - "traefik.http.routers.qbittorrent.tls=true"
