SoumyaJ commited on
Commit
5f14d16
·
verified ·
1 Parent(s): d64e464

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -14
Dockerfile CHANGED
@@ -1,10 +1,10 @@
 
1
  FROM python:3.9
2
 
3
- RUN useradd -m -u 1000 user
4
- USER user
5
- ENV PATH="/home/user/.local/bin:$PATH"
6
 
7
- # Set non-interactive mode to avoid user input issues
8
  ENV DEBIAN_FRONTEND=noninteractive
9
 
10
  # Fix permission issues by using --allow-releaseinfo-change
@@ -15,23 +15,23 @@ RUN apt-get update --allow-releaseinfo-change && \
15
  poppler-utils && \
16
  rm -rf /var/lib/apt/lists/* # Clean up
17
 
18
- # Install required Python packages
19
- RUN pip install --no-cache-dir \
20
- langchain \
21
- pdf2image \
22
- pytesseract \
23
- pillow \
24
- pymupdf \
25
- pypdf \
26
- unstructured[pdf]
27
 
28
  # Set Tesseract OCR path
29
  ENV TESSDATA_PREFIX="/usr/share/tesseract-ocr/4.00/tessdata"
30
 
 
31
  WORKDIR /app
32
 
 
33
  COPY --chown=user ./requirements.txt requirements.txt
34
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
35
 
36
- COPY --chown=user . /app
 
37
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Start from Python 3.9 image
2
  FROM python:3.9
3
 
4
+ # Switch to root to install system dependencies
5
+ USER root
 
6
 
7
+ # Set non-interactive mode
8
  ENV DEBIAN_FRONTEND=noninteractive
9
 
10
  # Fix permission issues by using --allow-releaseinfo-change
 
15
  poppler-utils && \
16
  rm -rf /var/lib/apt/lists/* # Clean up
17
 
18
+ # Add a non-root user
19
+ RUN useradd -m -u 1000 user
20
+
21
+ # Switch to the new user
22
+ USER user
23
+ ENV PATH="/home/user/.local/bin:$PATH"
 
 
 
24
 
25
  # Set Tesseract OCR path
26
  ENV TESSDATA_PREFIX="/usr/share/tesseract-ocr/4.00/tessdata"
27
 
28
+ # Set working directory
29
  WORKDIR /app
30
 
31
+ # Copy requirements and install Python packages
32
  COPY --chown=user ./requirements.txt requirements.txt
33
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
34
 
35
+ # Copy application files
36
+ COPY --chown=user . .
37
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]