Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +7 -7
Dockerfile
CHANGED
|
@@ -1,12 +1,11 @@
|
|
| 1 |
# Dockerfile for Safe Driving Assistant
|
| 2 |
-
|
| 3 |
# This container sets up a fully functional, headless-capable runtime environment
|
| 4 |
# for the AI Safe Driving Assistant. It includes all necessary C/C++ build
|
| 5 |
# dependencies for compiling dlib, PortAudio bindings (PyAudio), and sound/video
|
| 6 |
# codecs, along with Xvfb (Virtual Framebuffer) to prevent OpenCV GUI crashes.
|
| 7 |
|
| 8 |
# Use official lightweight Python base image
|
| 9 |
-
FROM python:3.
|
| 10 |
|
| 11 |
# Set environment variables to optimize Python performance and docker execution
|
| 12 |
ENV PYTHONUNBUFFERED=1 \
|
|
@@ -49,17 +48,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 49 |
x11-apps \
|
| 50 |
&& rm -rf /var/lib/apt/lists/*
|
| 51 |
|
| 52 |
-
# Upgrade pip, setuptools
|
| 53 |
-
RUN pip install --no-cache-dir --upgrade pip
|
|
|
|
| 54 |
|
|
|
|
| 55 |
RUN pip install "face_recognition @ git+https://github.com/lovnishverma/face_recognition.git"
|
| 56 |
-
|
| 57 |
RUN pip install git+https://github.com/ageitgey/face_recognition_models
|
| 58 |
|
| 59 |
# Copy requirements.txt first to leverage Docker's build cache
|
| 60 |
COPY requirements.txt .
|
| 61 |
|
| 62 |
-
# Install dependencies (dlib,
|
| 63 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 64 |
|
| 65 |
# Copy the rest of the application files
|
|
@@ -81,4 +81,4 @@ exec python main.py\n\
|
|
| 81 |
' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
|
| 82 |
|
| 83 |
# Use the virtual display entrypoint script
|
| 84 |
-
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
|
| 1 |
# Dockerfile for Safe Driving Assistant
|
|
|
|
| 2 |
# This container sets up a fully functional, headless-capable runtime environment
|
| 3 |
# for the AI Safe Driving Assistant. It includes all necessary C/C++ build
|
| 4 |
# dependencies for compiling dlib, PortAudio bindings (PyAudio), and sound/video
|
| 5 |
# codecs, along with Xvfb (Virtual Framebuffer) to prevent OpenCV GUI crashes.
|
| 6 |
|
| 7 |
# Use official lightweight Python base image
|
| 8 |
+
FROM python:3.11-slim
|
| 9 |
|
| 10 |
# Set environment variables to optimize Python performance and docker execution
|
| 11 |
ENV PYTHONUNBUFFERED=1 \
|
|
|
|
| 48 |
x11-apps \
|
| 49 |
&& rm -rf /var/lib/apt/lists/*
|
| 50 |
|
| 51 |
+
# Upgrade pip and wheel, but pin setuptools to prevent breaking face_recognition_models
|
| 52 |
+
RUN pip install --no-cache-dir --upgrade pip wheel && \
|
| 53 |
+
pip install --no-cache-dir "setuptools<80.0.0"
|
| 54 |
|
| 55 |
+
# Install custom face recognition repositories
|
| 56 |
RUN pip install "face_recognition @ git+https://github.com/lovnishverma/face_recognition.git"
|
|
|
|
| 57 |
RUN pip install git+https://github.com/ageitgey/face_recognition_models
|
| 58 |
|
| 59 |
# Copy requirements.txt first to leverage Docker's build cache
|
| 60 |
COPY requirements.txt .
|
| 61 |
|
| 62 |
+
# Install dependencies (dlib, pyaudio, and scipy compilation can take a while)
|
| 63 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 64 |
|
| 65 |
# Copy the rest of the application files
|
|
|
|
| 81 |
' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
|
| 82 |
|
| 83 |
# Use the virtual display entrypoint script
|
| 84 |
+
ENTRYPOINT ["/app/entrypoint.sh"]
|