crabbly commited on
Commit
a752532
·
verified ·
1 Parent(s): c9fb22a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -5
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  # Use official Python image
2
  FROM python:3.11-slim
3
 
4
- # Install modern system dependencies required by image processing
5
  RUN apt-get update && apt-get install -y \
6
  libgl1 \
7
  libglib2.0-0 \
@@ -13,12 +13,14 @@ WORKDIR /app
13
  # Copy your requirements
14
  COPY requirements.txt .
15
 
16
- # Install dependencies (CPU-only PyTorch to save space)
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # CRITICAL FIX: Ultralytics secretly installs the GUI version of OpenCV.
20
- # We must uninstall it so Python is forced to use opencv-python-headless!
21
- RUN pip uninstall -y opencv-python
 
 
22
 
23
  # Copy all your scripts and weights into the container
24
  COPY . .
 
1
  # Use official Python image
2
  FROM python:3.11-slim
3
 
4
+ # Install system dependencies
5
  RUN apt-get update && apt-get install -y \
6
  libgl1 \
7
  libglib2.0-0 \
 
13
  # Copy your requirements
14
  COPY requirements.txt .
15
 
16
+ # Install dependencies (Ultralytics will sneakily install the GUI version of OpenCV here)
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # CRITICAL FIX: Wipe out ALL versions of OpenCV so the cv2 folder is completely gone
20
+ RUN pip uninstall -y opencv-python opencv-python-headless
21
+
22
+ # Reinstall strictly the headless version as the final authority
23
+ RUN pip install --no-cache-dir opencv-python-headless
24
 
25
  # Copy all your scripts and weights into the container
26
  COPY . .