### SpotDL - Spotify Downloader with Web UI
### Based on spotdl: https://github.com/spotDL/spotify-downloader
###
### BUILD: podman build -t localhost/spotdl:latest .
### EXPORT: podman save -o /home/duckpage/Source/bds/bdi_podman_serverconf/containers/spotdl/spotdl.tar localhost/spotdl:latest
###
FROM debian:13-slim

# Installazione dipendenze di sistema
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    python3 \
    python3-pip \
    ffmpeg \
    aria2 \
    git \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Installazione spotDL
RUN pip3 install --no-cache-dir --break-system-packages spotdl

# Creazione directory configurazione e download
RUN mkdir -p /app/.config/spotdl /app/downloads

WORKDIR /app

# Volume mount point per i download
VOLUME ["/app/downloads"]

# Comando di default: avvia la web UI
CMD ["spotdl", "web", "--host", "0.0.0.0", "--port", "8800", "--keep-alive", "--keep-sessions"]