services:
  ytplayer:
    build: .
    restart: unless-stopped
    volumes:
      # libsql DB file persists across container rebuilds
      - ytplayer-data:/app/data
    environment:
      PORT: "3000"
      DB_PATH: "/app/data/ytplayer.db"
      APP_VERSION: "1.0.0"
      # Optional: override yt-dlp binary path if you mount a custom one
      # YTDLP_PATH: "/usr/local/bin/yt-dlp"
    healthcheck:
      test: ["CMD", "curl", "-sf", "http://localhost:3000/api/version"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 15s
    networks:
      - dokploy-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ytplayer-http.rule=Host(`worship.hesed.sbs`)"
      - "traefik.http.routers.ytplayer-http.entrypoints=web"
      - "traefik.http.routers.ytplayer-http.middlewares=redirect-to-https"
      - "traefik.http.routers.ytplayer-https.rule=Host(`worship.hesed.sbs`)"
      - "traefik.http.routers.ytplayer-https.entrypoints=websecure"
      - "traefik.http.routers.ytplayer-https.tls.certresolver=letsencrypt"
      - "traefik.http.services.ytplayer-svc.loadbalancer.server.port=3000"

volumes:
  ytplayer-data:
    driver: local

networks:
  dokploy-network:
    external: true
