# Dockerfile
FROM python:slim

WORKDIR /app

# System deps for archives and video thumbs (all FOSS)
RUN apt-get update && apt-get install -y --no-install-recommends \
    p7zip-full \
    unar \
    file \
    ffmpeg \
 && rm -rf /var/lib/apt/lists/*


# Install deps first for better layer caching
COPY requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt

# Copy the rest of the app
COPY . .

# Entrypoint controls migrations, background worker, and Gunicorn
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

EXPOSE 5000
ENTRYPOINT ["/entrypoint.sh"]