FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

RUN apt-get update \
    && apt-get install -y --no-install-recommends ffmpeg ca-certificates \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY sentence_api/requirements.txt /app/sentence_api/requirements.txt
RUN python -m pip install --upgrade pip \
    && python -m pip install -r /app/sentence_api/requirements.txt

COPY sentence_api /app/sentence_api
COPY sentence_analysis.py /app/sentence_analysis.py

EXPOSE 8000
CMD ["python", "-m", "uvicorn", "sentence_api.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1", "--proxy-headers", "--forwarded-allow-ips", "*"]
