# ffmpeg/ffprobe statiques complets (incluent zscale/zimg pour le tone-mapping HDR)
FROM mwader/static-ffmpeg:7.1 AS ffmpeg

FROM python:3.12-slim
COPY --from=ffmpeg /ffmpeg /usr/local/bin/ffmpeg
COPY --from=ffmpeg /ffprobe /usr/local/bin/ffprobe

WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app/ /app/

ENV MEDIA_DIR=/media \
    OUTPUT_DIR=/output \
    MAX_WORKERS=1

EXPOSE 8000
VOLUME ["/media", "/output"]

# --proxy-headers : respecte X-Forwarded-Proto/Host derrière Nginx Proxy Manager
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", \
     "--proxy-headers", "--forwarded-allow-ips", "*"]
