FROM python:3.12-slim

WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
    libgl1 libglib2.0-0 curl \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir \
    --extra-index-url https://download.pytorch.org/whl/cu126 \
    -r requirements.txt

# 모델 미다운로드 (HF cache volume → 첫 호출/warmup 시 적재).

COPY server.py .

EXPOSE 3300
HEALTHCHECK --start-period=300s --interval=30s --timeout=10s --retries=3 \
    CMD curl -f http://localhost:3300/ready || exit 1

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