OCR-Demo / Dockerfile
thangvckeygen's picture
Configure Docker SDK on Hugging Face Space with FastAPI and React White Theme
040b573
Raw
History Blame Contribute Delete
979 Bytes
FROM python:3.10-slim
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PORT=7860 \
HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Install essential system dependencies for OpenCV, PaddleOCR, PDF rendering
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgl1 \
libglib2.0-0 \
libgomp1 \
poppler-utils \
tesseract-ocr \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Create standard non-root user (UID 1000 required for Hugging Face Spaces)
RUN useradd -m -u 1000 user
USER user
WORKDIR /home/user/app
# Install Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -U pip setuptools wheel && \
pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY --chown=user . .
# Expose standard Hugging Face Space port
EXPOSE 7860
# Run FastAPI server
CMD ["python", "server.py", "--host", "0.0.0.0", "--port", "7860"]