CloudAnts commited on
Commit
1acd7aa
·
1 Parent(s): 2ae8e36
Files changed (1) hide show
  1. Dockerfile +17 -3
Dockerfile CHANGED
@@ -1,16 +1,30 @@
1
- # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
-
4
  FROM python:3.9
5
 
 
6
  RUN useradd -m -u 1000 user
7
  USER user
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
 
 
10
  WORKDIR /app
11
 
 
12
  COPY --chown=user ./requirements.txt requirements.txt
13
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
 
 
 
 
 
 
 
 
 
 
 
15
  COPY --chown=user . /app
 
 
16
  CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
 
1
+ # Use Python 3.9 as the base image
 
 
2
  FROM python:3.9
3
 
4
+ # Create a user with ID 1000
5
  RUN useradd -m -u 1000 user
6
  USER user
7
  ENV PATH="/home/user/.local/bin:$PATH"
8
 
9
+ # Set the working directory
10
  WORKDIR /app
11
 
12
+ # Copy the requirements.txt file and install dependencies
13
  COPY --chown=user ./requirements.txt requirements.txt
14
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
15
 
16
+ # Install system dependencies needed for OpenCV and other libraries
17
+ USER root
18
+ RUN apt-get update && apt-get install -y \
19
+ libgl1-mesa-glx \
20
+ libglib2.0-0 \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Return to the user 'user' for safety
24
+ USER user
25
+
26
+ # Copy the entire app directory to the container
27
  COPY --chown=user . /app
28
+
29
+ # Set the command to run the app with Gunicorn
30
  CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]