FROM python:3.11-slim WORKDIR /app # libgomp1: required by PyTorch/sentence-transformers RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 && rm -rf /var/lib/apt/lists/* # Install CPU-only PyTorch first to avoid downloading 2GB CUDA build RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu # ── Python deps ──────────────────────────────────────────────────────────────── COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # ── Application code ─────────────────────────────────────────────────────────── COPY app.py . # HF Spaces requires a non-root user with UID 1000 RUN useradd -m -u 1000 appuser && chown -R appuser /app USER appuser EXPOSE 7860 CMD ["python3", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]