File size: 1,196 Bytes
868bfa1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
40
41
42
43
# PDF Pipeline - Hugging Face Spaces Deployment
# This Dockerfile sets up the environment for the PDF extraction pipeline

FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Install system dependencies
# - tesseract-ocr: For Pytesseract OCR backend
# - libgl1-mesa-glx: Required for OpenCV
# - libglib2.0-0: Required for various Python packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    tesseract-ocr \
    tesseract-ocr-fra \
    tesseract-ocr-eng \
    libgl1-mesa-glx \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean

# Copy requirements first for better caching
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the entire application
COPY . .

# Expose the Streamlit port
EXPOSE 7860

# Set environment variables for Hugging Face
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/transformers

# Create cache directory
RUN mkdir -p /app/.cache/huggingface /app/.cache/transformers

# Run the Streamlit application
CMD ["streamlit", "run", "main.py", "--server.port", "7860", "--server.address", "0.0.0.0", "--server.headless", "true"]