FROM python:3.10-slim RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ libgomp1 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install PyTorch first from official index (fast & reliable CPU wheels) RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir \ torch==2.4.1 torchvision==0.19.1 \ --index-url https://download.pytorch.org/whl/cpu # Install everything else COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy your code COPY . . EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]