fix: revert to native python:3.10-slim with CMAKE_BUILD_PARALLEL_LEVEL=1 to fix dlib numpy pybind ABI conflict
2f53b35 | # Use official lightweight Python image | |
| FROM python:3.10-slim | |
| # Install system dependencies for 'dlib' (Face extraction) and 'ffmpeg' (Audio extraction) | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| ffmpeg \ | |
| libopenblas-dev \ | |
| liblapack-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Create HuggingFace User mapped to id 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Ensure we have the latest pip | |
| RUN pip install --user --no-cache-dir --upgrade pip | |
| # Install dlib explicitly first to cache its heavy C++ build phase | |
| # We MUST set CMAKE_BUILD_PARALLEL_LEVEL=1 and low optimization to prevent OOM crash! | |
| ENV CMAKE_BUILD_PARALLEL_LEVEL=1 | |
| ENV CXXFLAGS="-O1" | |
| RUN pip install --user --no-cache-dir "dlib>=19.24.0" | |
| # Install requirements | |
| COPY --chown=user web_ui/requirements.txt . | |
| RUN pip install --user --no-cache-dir -r requirements.txt | |
| # Copy the entire project codebase | |
| COPY --chown=user . . | |
| # Expose Gradio default port | |
| EXPOSE 7860 | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| # HF Spaces passes the user environment variables dynamically | |
| CMD ["python", "-u", "web_ui/app.py"] | |