AdarshDRC commited on
Commit
17de363
·
1 Parent(s): ef87e19

fix : Docker Build Faild issue

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -11
Dockerfile CHANGED
@@ -1,4 +1,6 @@
1
- # Dockerfile
 
 
2
 
3
  FROM python:3.10-slim
4
 
@@ -7,20 +9,35 @@ WORKDIR /app
7
  # ── System deps ──────────────────────────────────────────────────
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  libgl1 libglib2.0-0 libgomp1 git \
 
 
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- # ── Python deps ──────────────────────────────────────────────────
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  COPY requirements.txt .
14
- RUN pip install --no-cache-dir --compile -r requirements.txt
15
 
16
- # ── Copy application code ────────────────────────────────────────
17
  COPY . .
18
-
19
  RUN mkdir -p temp_uploads saved_images && chmod -R 777 temp_uploads saved_images
20
 
21
- # ── Pre-download ALL models at build time ───────────────────────
22
- # V3: Added InsightFace buffalo_sc (YuNet + ArcFace)
23
- # Replaces DeepFace + RetinaFace + GhostFaceNet entirely
24
  RUN python - <<'EOF'
25
  import os
26
  os.environ["TRANSFORMERS_VERBOSITY"] = "error"
@@ -42,17 +59,17 @@ from ultralytics import YOLO
42
  YOLO("yolo11n-seg.pt")
43
  print("YOLO done")
44
 
45
- print("Pre-downloading InsightFace buffalo_sc (YuNet + ArcFace)...")
46
  from insightface.app import FaceAnalysis
47
  app = FaceAnalysis(name="buffalo_sc", providers=["CPUExecutionProvider"])
48
  app.prepare(ctx_id=-1, det_size=(640, 640))
49
- print("InsightFace buffalo_sc done")
 
50
 
51
  print("All V3 models cached!")
52
  EOF
53
 
54
  EXPOSE 7860
55
-
56
  ENV WEB_CONCURRENCY=1
57
 
58
  CMD uvicorn main:app \
 
1
+ # Dockerfile — Enterprise Lens V3
2
+ # InsightFace needs: g++, cmake, Cython, scikit-build, onnxruntime
3
+ # All installed in correct order before insightface
4
 
5
  FROM python:3.10-slim
6
 
 
9
  # ── System deps ──────────────────────────────────────────────────
10
  RUN apt-get update && apt-get install -y --no-install-recommends \
11
  libgl1 libglib2.0-0 libgomp1 git \
12
+ build-essential cmake g++ \
13
+ libopenblas-dev liblapack-dev \
14
+ wget ca-certificates \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # ── Step 1: Core build tools (MUST be before insightface) ────────
18
+ RUN pip install --no-cache-dir \
19
+ "numpy<2.0" \
20
+ "setuptools>=65" \
21
+ wheel \
22
+ cython \
23
+ scikit-build \
24
+ cmake
25
+
26
+ # ── Step 2: onnxruntime (MUST be before insightface) ─────────────
27
+ RUN pip install --no-cache-dir onnxruntime
28
+
29
+ # ── Step 3: insightface (now has all deps available) ─────────────
30
+ RUN pip install --no-cache-dir --prefer-binary insightface
31
+
32
+ # ── Step 4: Remaining requirements ───────────────────────────────
33
  COPY requirements.txt .
34
+ RUN pip install --no-cache-dir --prefer-binary -r requirements.txt
35
 
36
+ # ── Copy app code ─────────────────────────────────────────────────
37
  COPY . .
 
38
  RUN mkdir -p temp_uploads saved_images && chmod -R 777 temp_uploads saved_images
39
 
40
+ # ── Pre-download all models at build time ─────────────────────────
 
 
41
  RUN python - <<'EOF'
42
  import os
43
  os.environ["TRANSFORMERS_VERBOSITY"] = "error"
 
59
  YOLO("yolo11n-seg.pt")
60
  print("YOLO done")
61
 
62
+ print("Pre-downloading InsightFace buffalo_sc...")
63
  from insightface.app import FaceAnalysis
64
  app = FaceAnalysis(name="buffalo_sc", providers=["CPUExecutionProvider"])
65
  app.prepare(ctx_id=-1, det_size=(640, 640))
66
+ del app
67
+ print("InsightFace done")
68
 
69
  print("All V3 models cached!")
70
  EOF
71
 
72
  EXPOSE 7860
 
73
  ENV WEB_CONCURRENCY=1
74
 
75
  CMD uvicorn main:app \