File size: 943 Bytes
4c2b7fa
 
 
 
 
 
1177087
 
 
d64e464
 
 
1177087
 
d64e464
 
1177087
d64e464
1177087
 
 
 
 
 
 
 
 
d64e464
1177087
92d6c74
4c2b7fa
 
 
 
 
 
 
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
FROM python:3.9

RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Set non-interactive mode to avoid user input issues
ENV DEBIAN_FRONTEND=noninteractive

# Fix permission issues by using --allow-releaseinfo-change
RUN apt-get update --allow-releaseinfo-change && \
    apt-get install -y --no-install-recommends \
    tesseract-ocr \
    libtesseract-dev \
    poppler-utils && \
    rm -rf /var/lib/apt/lists/*  # Clean up

# Install required Python packages
RUN pip install --no-cache-dir \
    langchain \
    pdf2image \
    pytesseract \
    pillow \
    pymupdf \
    pypdf \
    unstructured[pdf]

# Set Tesseract OCR path
ENV TESSDATA_PREFIX="/usr/share/tesseract-ocr/4.00/tessdata"

WORKDIR /app

COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

COPY --chown=user . /app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]