File size: 936 Bytes
887b9c5
 
0690bf9
887b9c5
e983d4f
887b9c5
 
0690bf9
887b9c5
a2f8fca
0690bf9
 
324a36a
 
 
 
 
 
a2f8fca
 
 
 
324a36a
 
0690bf9
887b9c5
 
 
 
3a91fef
0690bf9
 
8e9556b
eac800d
0690bf9
d0c655e
 
887b9c5
d0c655e
0690bf9
 
887b9c5
0690bf9
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
44
# Base image
FROM python:3.10-slim

# Set env to avoid interactive prompts and ensure models cache to /tmp
ENV HF_HOME=/tmp \
    XDG_CACHE_HOME=/tmp \
    PYTHONUNBUFFERED=1

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    poppler-utils \
    tesseract-ocr \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    build-essential \
    libpoppler-dev \
    libtesseract-dev \
    libblas-dev \
    liblapack-dev \
    gfortran \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy requirements and install
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy app files
COPY . .

# Create upload directory and give full write permissions
RUN mkdir -p /tmp/uploads && chmod 777 /tmp/uploads

# Expose port (for local or HF Spaces)
EXPOSE 7860

# Start the Flask app
CMD ["python", "app.py"]