Nomi78600 commited on
Commit
3c86a5e
·
1 Parent(s): 57c1048

Final Fix: Switch to opencv-python-headless

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -8
  2. requirements.txt +1 -1
Dockerfile CHANGED
@@ -1,17 +1,11 @@
1
  # Use the Python version that matches your local machine
2
  FROM python:3.12-slim
3
 
4
- # --- THIS IS THE FIX ---
5
- # Install the system dependency required by opencv-python (cv2)
6
- # This must be done before switching to the non-root user
7
- RUN apt-get update && apt-get install -y libgl1-mesa-glx
8
- # --------------------
9
-
10
  # Set environment variables for Python
11
  ENV PYTHONDONTWRITEBYTECODE 1
12
  ENV PYTHONUNBUFFERED 1
13
 
14
- # Create and switch to a non-root user for better security
15
  RUN useradd -m -u 1000 user
16
  USER user
17
 
@@ -19,7 +13,7 @@ USER user
19
  WORKDIR /home/user/app
20
  ENV PATH="/home/user/.local/bin:${PATH}"
21
 
22
- # Copy and install Python dependencies
23
  COPY --chown=user requirements.txt .
24
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
25
 
 
1
  # Use the Python version that matches your local machine
2
  FROM python:3.12-slim
3
 
 
 
 
 
 
 
4
  # Set environment variables for Python
5
  ENV PYTHONDONTWRITEBYTECODE 1
6
  ENV PYTHONUNBUFFERED 1
7
 
8
+ # Create and switch to a non-root user for security
9
  RUN useradd -m -u 1000 user
10
  USER user
11
 
 
13
  WORKDIR /home/user/app
14
  ENV PATH="/home/user/.local/bin:${PATH}"
15
 
16
+ # Copy and install Python dependencies from the corrected requirements file
17
  COPY --chown=user requirements.txt .
18
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
 
requirements.txt CHANGED
@@ -37,7 +37,6 @@ ml-dtypes==0.4.1
37
  namex==0.0.8
38
  numpy==2.0.2
39
  openai==1.45.1
40
- opencv-python==4.11.0.86
41
  opt_einsum==3.4.0
42
  optree==0.13.1
43
  packaging==24.2
@@ -67,3 +66,4 @@ Werkzeug==3.1.3
67
  wheel==0.45.0
68
  wrapt==1.16.0
69
  tensorflow
 
 
37
  namex==0.0.8
38
  numpy==2.0.2
39
  openai==1.45.1
 
40
  opt_einsum==3.4.0
41
  optree==0.13.1
42
  packaging==24.2
 
66
  wheel==0.45.0
67
  wrapt==1.16.0
68
  tensorflow
69
+ opencv-python-headless