FROM python:3.12-alpine
ENV PYTHONUNBUFFERED=1

# ffmpeg for audio/video processing, ttf-dejavu + fontconfig for PIL overlays.
# Alpine installs DejaVu fonts to /usr/share/fonts/dejavu/, but app code
# references the Debian-style path; symlink for compatibility.
RUN apk add --no-cache ffmpeg ttf-dejavu fontconfig \
    && mkdir -p /usr/share/fonts/truetype \
    && ln -sf /usr/share/fonts/dejavu /usr/share/fonts/truetype/dejavu \
    && fc-cache -f

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

COPY . .

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
