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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -2
Dockerfile CHANGED
@@ -1,8 +1,9 @@
1
  # Use official Python image
2
  FROM python:3.11-slim
3
 
4
- # Install system dependencies required by OpenCV and other libraries
5
  RUN apt-get update && apt-get install -y \
 
6
  libglib2.0-0 \
7
  && rm -rf /var/lib/apt/lists/*
8
 
@@ -15,8 +16,12 @@ COPY requirements.txt .
15
  # Install dependencies (CPU-only PyTorch to save space)
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
 
 
 
 
18
  # Copy all your scripts and weights into the container
19
  COPY . .
20
 
21
- # Hugging Face requires Docker spaces to run on port 7860!
22
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
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 \
8
  && rm -rf /var/lib/apt/lists/*
9
 
 
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 . .
25
 
26
+ # Hugging Face requires Docker spaces to run on port 7860
27
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]