| FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04 | |
| WORKDIR /app | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV PYTHONUNBUFFERED=1 | |
| # Python + git | |
| RUN apt-get update && \ | |
| apt-get install -y python3.11 python3.11-dev python3-pip git curl && \ | |
| ln -sf python3.11 /usr/bin/python && \ | |
| ln -sf python3.11 /usr/bin/python3 && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Torch with CUDA 12.1 first (avoids pip installing CPU version later) | |
| RUN pip install --no-cache-dir \ | |
| torch==2.3.0 torchvision \ | |
| --index-url https://download.pytorch.org/whl/cu121 | |
| # Remaining dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # App files | |
| COPY . . | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |