pdf-ocr / Dockerfile
shubhjo's picture
Update Dockerfile
d76e78e verified
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-eng tesseract-ocr-hin tesseract-ocr-ara tesseract-ocr-spa \
tesseract-ocr-ita tesseract-ocr-fra tesseract-ocr-rus \
poppler-utils \
libopencv-dev \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables to avoid permission issues
ENV XDG_CACHE_HOME=/tmp
ENV FONTCONFIG_PATH=/tmp
# Create temporary directories
RUN mkdir -p /tmp/fontconfig
# Set working directory
WORKDIR /app
# Copy files
COPY . /app/
# Debug: List files
RUN ls -la /app
# Verify files
RUN if [ ! -f /app/requirements.txt ]; then echo "requirements.txt not found" && exit 1; fi
RUN if [ ! -f /app/app.py ]; then echo "app.py not found" && exit 1; fi
# Install Python dependencies
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r /app/requirements.txt
# Expose Hugging Face Spaces default port
EXPOSE 7860
# Run the app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]