Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # System deps for building packages from source | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git \ | |
| build-essential \ | |
| python3-dev \ | |
| portaudio19-dev \ | |
| libasound2-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy requirements first to leverage Docker layer caching | |
| COPY requirements.txt /app/requirements.txt | |
| # Key fix for your madmom/Cython issue: | |
| # disable build isolation so Cython installed in the environment is visible at build time | |
| ENV PIP_NO_BUILD_ISOLATION=1 | |
| RUN pip install --no-cache-dir -U pip wheel Cython | |
| RUN pip install --no-cache-dir setuptools==80.9.0 | |
| RUN pip install --no-cache-dir -r /app/requirements.txt | |
| RUN pip install --no-cache-dir --no-build-isolation madmom | |
| # madmom patch | |
| COPY patch_madmom.py /app/scripts/patch_madmom.py | |
| # ... after installing madmom ... | |
| RUN python /app/scripts/patch_madmom.py | |
| RUN python -c "import madmom; print('madmom import OK')" | |
| # Copy the rest of the repo | |
| COPY . /app | |
| # HF Spaces routes traffic to $PORT (usually 7860). Gradio should listen on it. | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONIOENCODING=UTF-8 | |
| CMD ["python", "-u", "app.py"] | |