m-abdur2024 commited on
Commit
532655a
1 Parent(s): 1499565

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -1
Dockerfile CHANGED
@@ -1,15 +1,25 @@
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
 
 
9
  COPY --chown=user ./requirements.txt requirements.txt
10
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
 
 
 
 
 
 
 
 
 
12
  COPY --chown=user . /app
13
 
14
- # Change the command to use gunicorn instead of uvicorn and bind it to port 7860
15
  CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860"]
 
1
  FROM python:3.9
2
 
3
+ # Create a user and switch to it
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
  WORKDIR /app
9
 
10
+ # Copy and install the required packages from requirements.txt
11
  COPY --chown=user ./requirements.txt requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
+ # Install libgl1-mesa-glx for OpenGL (libGL.so.1) and related dependencies
15
+ USER root
16
+ RUN apt-get update && apt-get install -y libgl1-mesa-glx
17
+
18
+ # Switch back to the non-root user after installing dependencies
19
+ USER user
20
+
21
+ # Copy the application code to the container
22
  COPY --chown=user . /app
23
 
24
+ # Use gunicorn to start the app and bind it to port 7860
25
  CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860"]