Amina commited on
Commit
b87e880
·
1 Parent(s): c2da201

Fix dockerfile will all cv dependencies

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -1
Dockerfile CHANGED
@@ -1,6 +1,33 @@
1
  FROM python:3.9-slim
2
 
3
- RUN apt-get update && apt-get install -y libgl1 libglib2.0-0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  WORKDIR /code
6
 
 
1
  FROM python:3.9-slim
2
 
3
+ # Start with the official Python 3.9 image
4
+ FROM python:3.9-slim
5
+
6
+ # Install a comprehensive set of system libraries for headless OpenCV
7
+ # This prevents errors like "libGL.so.1" and "libgthread-2.0.so.0"
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ ffmpeg \
10
+ libsm6 \
11
+ libxext6 \
12
+ libgl1 \
13
+ libglib2.0-0 \
14
+ && apt-get clean \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Set the working directory inside the container
18
+ WORKDIR /code
19
+
20
+ # Copy the requirements file first to leverage Docker's layer caching
21
+ COPY ./requirements.txt /code/requirements.txt
22
+
23
+ # Install the Python dependencies
24
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
25
+
26
+ # Copy the rest of your application files
27
+ COPY . .
28
+
29
+ # Command to run the Uvicorn server
30
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
31
 
32
  WORKDIR /code
33