FROM python:3.12-slim RUN apt-get update && \ apt-get install -y --no-install-recommends \ curl \ git && \ rm -rf /var/lib/apt/lists/* COPY requirements.txt . # Install CPU-only PyTorch first (lighter, no GPU dependencies) RUN python -m pip install --upgrade pip && \ pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \ pip install --no-cache-dir -r requirements.txt RUN useradd -m -u 1000 user WORKDIR /app COPY --chown=user:user . . USER user ENV PATH="/home/user/.local/bin:$PATH" EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]