document-engine / Dockerfile
basudevm23's picture
Update Dockerfile
26f9a23 verified
Raw
History Blame Contribute Delete
1.02 kB
# Use a lightweight Python base image
FROM python:3.10-slim
# Create a non-root user with UID 1000 (Required by Hugging Face Spaces)
RUN useradd -m -u 1000 user
# Install system dependencies for OCR and PDF processing
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-eng \
tesseract-ocr-spa \
tesseract-ocr-ara \
tesseract-ocr-chi-sim \
tesseract-ocr-ita \
tesseract-ocr-msa \
poppler-utils \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
# Switch to the non-root user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory
WORKDIR $HOME/app
# Copy requirements and install
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of your app files
COPY --chown=user . .
# Hugging Face Spaces expose port 7860 by default
EXPOSE 7860
# Start the FastAPI app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]