tregu0458 commited on
Commit
9c0fe6d
·
verified ·
1 Parent(s): ccab946

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -8
Dockerfile CHANGED
@@ -1,26 +1,34 @@
1
  FROM python:3.10.9
2
 
3
- COPY . .
4
-
5
-
6
  # Set the working directory to /app
7
  WORKDIR /app
8
 
9
  # Create a directory for storing downloaded PDF files
10
  RUN mkdir /app/downloads
11
 
12
- # Set permissions for the downloads directory
13
- # RUN chown -R root:root /app/downloads && chmod -R 777 /app/downloads
14
 
15
  # Copy the current directory contents into the container at /app
16
  COPY . /app
17
 
 
18
  RUN apt-get update && apt-get install -y \
19
  libgl1-mesa-glx \
20
- libglib2.0-0
21
- RUN apt-get install poppler-utils -y
22
- RUN apt-get install tesseract-ocr -y
23
 
 
24
  RUN pip install --no-cache-dir --upgrade -r /requirements.txt
25
 
 
 
 
 
 
 
 
 
 
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10.9
2
 
 
 
 
3
  # Set the working directory to /app
4
  WORKDIR /app
5
 
6
  # Create a directory for storing downloaded PDF files
7
  RUN mkdir /app/downloads
8
 
9
+ # Create a non-root user
10
+ RUN useradd -m appuser
11
 
12
  # Copy the current directory contents into the container at /app
13
  COPY . /app
14
 
15
+ # Install system dependencies
16
  RUN apt-get update && apt-get install -y \
17
  libgl1-mesa-glx \
18
+ libglib2.0-0 \
19
+ poppler-utils \
20
+ tesseract-ocr
21
 
22
+ # Install Python dependencies
23
  RUN pip install --no-cache-dir --upgrade -r /requirements.txt
24
 
25
+ # Change ownership of the app directory to the non-root user
26
+ RUN chown -R appuser:appuser /app
27
+
28
+ # Switch to the non-root user
29
+ USER appuser
30
+
31
+ # Set the nltk_data directory path
32
+ ENV NLTK_DATA /app/nltk_data
33
+
34
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]