SakibAhmed commited on
Commit
4d10d86
·
verified ·
1 Parent(s): cc786a4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -28
Dockerfile CHANGED
@@ -1,29 +1,40 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.10-slim
3
-
4
- # Set the working directory in the container
5
- WORKDIR /app
6
-
7
- # Copy the requirements file
8
- COPY requirements.txt requirements.txt
9
-
10
- # Install Python packages
11
- RUN pip install --no-cache-dir -r requirements.txt
12
-
13
- # Copy application code
14
- COPY . /app
15
-
16
- # Create a non-root user
17
- RUN useradd -m -u 1000 user
18
-
19
- # Change ownership
20
- RUN chown -R user:user /app
21
-
22
- # Switch to the non-root user
23
- USER user
24
-
25
- # Expose the port Gunicorn will run on (Using 7860 as in CMD)
26
- EXPOSE 7860
27
-
28
- # Command to run the app
 
 
 
 
 
 
 
 
 
 
 
29
  CMD ["python", "app.py", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.10-slim
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies for OpenCV and other packages
8
+ RUN apt-get update && apt-get install -y \
9
+ libgl1-mesa-glx \
10
+ libglib2.0-0 \
11
+ libsm6 \
12
+ libxext6 \
13
+ libxrender-dev \
14
+ libgomp1 \
15
+ libgthread-2.0-0 \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Copy the requirements file
19
+ COPY requirements.txt requirements.txt
20
+
21
+ # Install Python packages
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
+
24
+ # Copy application code
25
+ COPY . /app
26
+
27
+ # Create a non-root user
28
+ RUN useradd -m -u 1000 user
29
+
30
+ # Change ownership
31
+ RUN chown -R user:user /app
32
+
33
+ # Switch to the non-root user
34
+ USER user
35
+
36
+ # Expose the port Gunicorn will run on (Using 7860 as in CMD)
37
+ EXPOSE 7860
38
+
39
+ # Command to run the app
40
  CMD ["python", "app.py", "--host", "0.0.0.0", "--port", "7860"]