FROM python:3.12-slim

WORKDIR /app

# PyMuPDF/Pillow 시스템 의존성 + CUDA wheel 의 런타임 로더
RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1 libglib2.0-0 && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
# torch / torchvision 는 PyTorch 인덱스의 cu126 wheel 고정.
# native /opt/surya-ocr/venv 검증된 조합 (torch 2.11.0+cu126, transformers 4.57.x).
RUN pip install --no-cache-dir \
    --extra-index-url https://download.pytorch.org/whl/cu126 \
    -r requirements.txt

COPY server.py .

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