anilegin's picture
Update Dockerfile
26d75c8 verified
Raw
History Blame
1.28 kB
# 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"]