# ========================================================================= # DocuLens — Hugging Face Spaces Dockerfile # ========================================================================= # Docker-based HF Space. Port 7860 is the HF Spaces default. # HF free-tier Spaces get 2 vCPU / 16 GB RAM — much better than Render # free tier for CPU-bound JSON serialisation of large base64 payloads. # ========================================================================= FROM python:3.11-slim # --- System dependencies -------------------------------------------------- RUN apt-get update && \ apt-get install -y --no-install-recommends \ tesseract-ocr \ libglib2.0-0 \ libgl1 \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # --- Python dependencies -------------------------------------------------- WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # --- Application code ------------------------------------------------------ COPY . . # --- Runtime --------------------------------------------------------------- # HF Spaces expects port 7860 by default. # Run as non-root for security (HF Spaces requires uid 1000). RUN useradd -m -u 1000 appuser USER appuser ENV PORT=7860 EXPOSE 7860 CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT}"]