File size: 1,277 Bytes
26d75c8
7e3b056
 
26d75c8
7e3b056
 
 
 
 
 
 
 
 
ecdcbd3
7e3b056
 
 
 
ad895f9
7e3b056
 
 
26d75c8
 
 
 
7e3b056
ecdcbd3
26d75c8
 
 
7e3b056
ecdcbd3
7e3b056
 
 
ecdcbd3
7e3b056
7bf5fe8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Use stable Bullseye (Debian 11)
FROM python:3.9-slim-bullseye

# 1. Install System Dependencies & Compiler
RUN apt-get update && apt-get install -y \
    build-essential \
    libgl1-mesa-glx \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    && rm -rf /var/lib/apt/lists/*

# 2. Setup User
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# 3. Workdir
WORKDIR /app
COPY --chown=user requirements.txt requirements.txt

# 4. THE NUCLEAR INSTALL STEP
# A. Install generic requirements
# B. Force Uninstall potential conflicts
# C. Force Install the specific "Golden Combination" that works
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt && \
    pip uninstall -y protobuf numpy opencv-python opencv-contrib-python opencv-python-headless mediapipe && \
    pip install "numpy<2" "protobuf==3.20.3" "opencv-contrib-python-headless" "mediapipe==0.10.9" && \
    python -c "import cv2; import mediapipe; print('✅ SUCCESS: CV2 and MediaPipe imported!')"

# 5. Copy Code & Setup Directories
COPY --chown=user . .
RUN mkdir -p /home/user/.insightface && chmod 777 /home/user/.insightface

# 6. Run
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]