File size: 1,187 Bytes
033f1b6
56a0184
 
 
94992f7
 
 
a73e689
 
56a0184
 
 
 
 
 
 
 
 
 
 
c877ebc
 
 
033f1b6
56a0184
a52103d
4e3ad8c
a52103d
4e3ad8c
 
a52103d
8129c83
4c0769b
56a0184
 
 
 
 
 
 
384d531
 
 
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
40
41
42
43
44
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"]