Spaces:
Sleeping
Sleeping
| # Use Python 3.11 slim as base image | |
| FROM python:3.11-slim | |
| # Prevent Python from writing pyc files and buffering stdout | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # Install system dependencies | |
| # - ffmpeg: Required for Whisper audio processing | |
| # - git: Required for installing some git-based pip packages | |
| # - curl/nodejs: Required for running MCP servers (like Notion) via npx | |
| # - build-essential: Required for compiling Python C extensions (critical for ML/Audio libs) | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg \ | |
| git \ | |
| curl \ | |
| build-essential \ | |
| && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | |
| && apt-get install -y nodejs \ | |
| && apt-get install -y patchelf \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements file first to leverage Docker cache | |
| COPY requirements.txt . | |
| # Upgrade pip to ensure the latest resolver handles complex dependencies | |
| RUN pip install --upgrade pip | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Fix for "cannot enable executable stack" error on HF Spaces | |
| # Find all libctranslate2 shared objects (including in .libs dirs) and clear the executable stack flag | |
| RUN find /usr/local/lib/python3.11/site-packages -name 'libctranslate2*.so*' -exec patchelf --clear-execstack {} \; | |
| # Copy the rest of the application | |
| COPY . . | |
| # Expose the Gradio port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["python", "app.py"] | |