# ── Qwen2.5-VL OCR — HuggingFace Spaces Dockerfile ─────────────────────────── FROM python:3.10-slim RUN apt-get update && apt-get install -y --no-install-recommends \ git \ libglib2.0-0 \ libgl1 \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 appuser WORKDIR /app # Install PyTorch CPU-only first, explicitly from the CPU wheel index RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir \ torch torchvision \ --index-url https://download.pytorch.org/whl/cpu # Install remaining deps COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py . # /tmp is always writable by any user — used as fallback cache in the app. # If HF persistent storage is mounted at /data, the app will prefer that. # Do NOT set HF_HOME here; the app picks the right path at runtime. USER 1000 EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]