Spaces:
Runtime error
Runtime error
File size: 1,356 Bytes
04c4194 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # =========================================================================
# 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}"]
|