FROM python:3.11-slim

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

WORKDIR /app
# The Titan Xp (Pascal, sm_61) needs a torch build old enough to still ship
# Pascal kernels; recent default PyPI wheels dropped sm_60/sm_61 entirely.
ENV PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cu124
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY app.py .

EXPOSE 8020
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8020"]
