Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -12
Dockerfile
CHANGED
|
@@ -1,29 +1,25 @@
|
|
| 1 |
# Use official Python image
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
-
# Install
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
libgl1 \
|
| 7 |
libglib2.0-0 \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
-
# Set the working directory
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
-
# Copy your requirements
|
| 14 |
COPY requirements.txt .
|
| 15 |
|
| 16 |
-
# Install dependencies
|
| 17 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
-
# CRITICAL FIX: Uninstall YOLO's default OpenCV versions
|
| 20 |
-
RUN pip uninstall -y opencv-python opencv-python-headless
|
| 21 |
-
|
| 22 |
-
# Reinstall strictly the CONTRIB headless version so cv2.mcc works!
|
| 23 |
-
RUN pip install --no-cache-dir opencv-contrib-python-headless
|
| 24 |
-
|
| 25 |
-
# Copy all your scripts and weights into the container
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
-
# Hugging Face requires Docker spaces to run on port 7860
|
| 29 |
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 the necessary Linux packages so standard OpenCV runs flawlessly
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
libgl1 \
|
| 7 |
libglib2.0-0 \
|
| 8 |
+
libsm6 \
|
| 9 |
+
libxext6 \
|
| 10 |
+
libxrender-dev \
|
| 11 |
+
libx11-xcb1 \
|
| 12 |
+
libxcb1 \
|
| 13 |
+
ffmpeg \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
|
|
|
| 16 |
WORKDIR /app
|
| 17 |
|
|
|
|
| 18 |
COPY requirements.txt .
|
| 19 |
|
| 20 |
+
# Install dependencies cleanly (no pip uninstall hacks!)
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
COPY . .
|
| 24 |
|
|
|
|
| 25 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|