Hammad712 commited on
Commit
6d4c144
·
verified ·
1 Parent(s): e91cd29

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -2
Dockerfile CHANGED
@@ -1,6 +1,8 @@
 
1
  FROM python:3.9
2
 
3
  # Install system dependencies
 
4
  RUN apt-get update \
5
  && apt-get install -y --no-install-recommends \
6
  poppler-utils \
@@ -8,20 +10,23 @@ RUN apt-get update \
8
 
9
  # Create a new user to run the app
10
  RUN useradd -m -u 1000 user
 
 
11
  USER user
12
 
13
  # Set environment variables
14
  ENV PATH="/home/user/.local/bin:$PATH"
 
15
 
16
  # Set the working directory
17
  WORKDIR /app
18
 
19
  # Copy the requirements and install Python dependencies
20
- COPY --chown=user ./requirements.txt requirements.txt
21
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
22
 
23
  # Copy the rest of the application
24
- COPY --chown=user . /app
25
 
26
  # Expose port 7860 for the application
27
  EXPOSE 7860
 
1
+ # Base image using Python 3.9
2
  FROM python:3.9
3
 
4
  # Install system dependencies
5
+ USER root
6
  RUN apt-get update \
7
  && apt-get install -y --no-install-recommends \
8
  poppler-utils \
 
10
 
11
  # Create a new user to run the app
12
  RUN useradd -m -u 1000 user
13
+
14
+ # Switch to non-root user
15
  USER user
16
 
17
  # Set environment variables
18
  ENV PATH="/home/user/.local/bin:$PATH"
19
+ ENV PYTHONPATH="/app"
20
 
21
  # Set the working directory
22
  WORKDIR /app
23
 
24
  # Copy the requirements and install Python dependencies
25
+ COPY --chown=user:root requirements.txt ./
26
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
27
 
28
  # Copy the rest of the application
29
+ COPY --chown=user:root . ./
30
 
31
  # Expose port 7860 for the application
32
  EXPOSE 7860