| FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN apt-get update && apt-get install -y \ | |
| python3.11 \ | |
| python3.11-venv \ | |
| python3-pip \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 | |
| RUN update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 | |
| WORKDIR /app | |
| # Upgrade pip to fix resolver bugs | |
| RUN pip install --upgrade pip | |
| # Install stable packages FIRST (these should never fail) | |
| RUN pip install --no-cache-dir torch pillow sentencepiece protobuf fastapi uvicorn | |
| # Install HuggingFace packages from git (might be slow/flaky) | |
| RUN pip install --no-cache-dir git+https://github.com/huggingface/peft.git | |
| RUN pip install --no-cache-dir git+https://github.com/huggingface/transformers.git | |
| RUN pip install --no-cache-dir git+https://github.com/huggingface/accelerate.git | |
| RUN pip install --no-cache-dir git+https://github.com/huggingface/diffusers.git | |
| COPY app.py . | |
| COPY handler.py . | |
| EXPOSE 8080 | |
| CMD ["python", "app.py"] | |