version: '3.9'

services:
  jellyfin:
    image: jellyfin/jellyfin:10.9.10
    environment:
      - JELLYFIN_PublishedServerUrl=jellyfin.pressmess.duckdns.org
    volumes:
      - /export/jellyfin:/config
      - jellyfin_cache:/cache
      - /export/media:/media/movies:ro
      - /export/tv_shows:/media/tv:ro
    networks:
      - caddy-public
    deploy:
      resources:
        limits:
          memory: 4G
          cpus: '2.0'
        reservations:
          memory: 1G
          cpus: '0.5'
      placement:
        constraints:
          - node.role == manager
      labels:
        - caddy.enable=true
        - caddy.http.routers.jellyfin.rule=Host(`jellyfin.pressmess.duckdns.org`)
        - caddy.http.routers.jellyfin.entrypoints=websecure
        - caddy.http.routers.jellyfin.tls=true
        - caddy.http.services.jellyfin.loadbalancer.server.port=8096

volumes:
  jellyfin_cache:
    driver: local

networks:
  caddy-public:
    external: true
