vrfefavr commited on
Commit
1808a06
·
verified ·
1 Parent(s): a792089

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -9
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM python:3.9-slim
2
 
3
- # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  libgl1 \
6
  libglib2.0-0 \
@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y \
9
 
10
  WORKDIR /app
11
 
12
- # Create user
13
  RUN useradd -m -u 1000 user
14
  RUN mkdir -p /home/user/.deepface/weights && \
15
  mkdir -p /app/faces_db && \
@@ -17,20 +17,35 @@ RUN mkdir -p /home/user/.deepface/weights && \
17
  chown -R user:user /app && \
18
  chown -R user:user /home/user/.deepface
19
 
20
- # Pre-download weights
21
  RUN wget https://github.com/serengil/deepface_models/releases/download/v1.0/vgg_face_weights.h5 \
22
  -O /home/user/.deepface/weights/vgg_face_weights.h5
23
 
24
  USER user
25
  ENV PATH="/home/user/.local/bin:$PATH"
26
 
27
- # --- WAY A: FORCE-DELETE REDUNDANCY ---
28
- # We install the "Light" engines first, then force DeepFace to accept them.
29
- RUN pip install --no-cache-dir --upgrade pip && \
30
- pip install --no-cache-dir tensorflow-cpu==2.15.0 mediapipe protobuf==3.20.3 opencv-python-headless && \
31
- pip install --no-cache-dir deepface==0.0.92 --no-deps && \
32
- pip install --no-cache-dir gradio==4.44.1 pandas pydantic==2.8.2 jinja2
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  COPY --chown=user . .
35
 
 
36
  CMD ["python", "app.py"]
 
1
  FROM python:3.9-slim
2
 
3
+ # Install system dependencies required for OpenCV and MediaPipe
4
  RUN apt-get update && apt-get install -y \
5
  libgl1 \
6
  libglib2.0-0 \
 
9
 
10
  WORKDIR /app
11
 
12
+ # Create user and setup directories
13
  RUN useradd -m -u 1000 user
14
  RUN mkdir -p /home/user/.deepface/weights && \
15
  mkdir -p /app/faces_db && \
 
17
  chown -R user:user /app && \
18
  chown -R user:user /home/user/.deepface
19
 
20
+ # Pre-download VGG-Face weights to prevent timeouts
21
  RUN wget https://github.com/serengil/deepface_models/releases/download/v1.0/vgg_face_weights.h5 \
22
  -O /home/user/.deepface/weights/vgg_face_weights.h5
23
 
24
  USER user
25
  ENV PATH="/home/user/.local/bin:$PATH"
26
 
27
+ # ==========================================
28
+ # 🛡️ THE SURGICAL INSTALLATION (Fixes Exit 139)
29
+ # ==========================================
30
+ RUN pip install --no-cache-dir --upgrade pip
 
 
31
 
32
+ # Step 1: Install base libraries (Forces only ONE version of OpenCV and TF)
33
+ RUN pip install --no-cache-dir \
34
+ tensorflow-cpu==2.15.0 \
35
+ opencv-python-headless==4.11.0.86 \
36
+ numpy==1.26.4 \
37
+ pandas \
38
+ protobuf==3.20.3 \
39
+ gradio==4.44.1
40
+
41
+ # Step 2: Muzzle MediaPipe (Install without dependencies to stop OpenCV collision)
42
+ RUN pip install --no-cache-dir mediapipe==0.10.14 --no-deps
43
+
44
+ # Step 3: Install DeepFace (Without dependencies to prevent it downloading full TF)
45
+ RUN pip install --no-cache-dir deepface==0.0.92 --no-deps
46
+
47
+ # Copy application files
48
  COPY --chown=user . .
49
 
50
+ # Run directly via Python to preserve Gradio metadata
51
  CMD ["python", "app.py"]