ujalaarshad17 commited on
Commit
8925889
·
1 Parent(s): 2f41ef1

requirements.txt

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -9
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
- WORKDIR /app
8
  RUN apt-get update && \
9
  apt-get install -y \
10
  libgl1-mesa-glx \
@@ -14,10 +14,24 @@ RUN apt-get update && \
14
  libxrender1 && \
15
  rm -rf /var/lib/apt/lists/*
16
 
17
- # Check if libraries are installed
18
- RUN ldconfig -p | grep libGL
19
- COPY --chown=user ./requirements.txt requirements.txt
 
 
 
 
 
 
 
 
 
 
 
20
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
21
 
22
- COPY --chown=user . /app
23
- CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
 
 
 
 
1
+ # Use the official Python image with version 3.9
2
  FROM python:3.9
3
 
4
+ # Set environment variable to prevent interactive prompts during package installation
5
+ ENV DEBIAN_FRONTEND=noninteractive
 
6
 
7
+ # Install necessary system packages as root
8
  RUN apt-get update && \
9
  apt-get install -y \
10
  libgl1-mesa-glx \
 
14
  libxrender1 && \
15
  rm -rf /var/lib/apt/lists/*
16
 
17
+ # Create a new user with user ID 1000 and switch to it
18
+ RUN useradd -m -u 1000 user
19
+
20
+ # Set the working directory
21
+ WORKDIR /app
22
+
23
+ # Switch to the new user
24
+ USER user
25
+
26
+ # Set up the PATH for the new user
27
+ ENV PATH="/home/user/.local/bin:$PATH"
28
+
29
+ # Copy the requirements file and install Python packages
30
+ COPY --chown=user:user requirements.txt ./
31
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
32
 
33
+ # Copy the entire application code into the container
34
+ COPY --chown=user:user . .
35
+
36
+ # Set the command to run the application using Gunicorn
37
+ CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]