File size: 2,186 Bytes
8795ab5
 
2d610a5
 
 
 
349e46d
 
 
 
2d610a5
 
 
 
 
 
 
 
 
 
 
 
 
 
a0f6c29
 
 
 
 
 
 
 
 
4a367ac
a0f6c29
 
 
 
 
349e46d
a0f6c29
349e46d
a0f6c29
 
349e46d
 
 
 
 
 
 
 
2d610a5
 
 
 
 
 
 
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Use Python 3.10.13 as the base image
FROM python:3.10.13-slim

# Set the working directory in the container
WORKDIR /app

# Upgrade pip, install git, MeCab and its dependencies
RUN apt-get update \
    && apt-get install -y git mecab libmecab-dev mecab-ipadic mecab-ipadic-utf8 \
    && pip install --upgrade pip

# Install PyTorch
RUN pip install torch

# Install other dependencies from requirements.txt
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt

# List installed packages for debugging
RUN pip list

# Copy the rest of your application's code
COPY . /app/

# Set the correct permissions for the copied files
RUN chmod -R 777 /app

# Replace the librosa files with your custom versions and set permissions
COPY packages/notation.py /usr/local/lib/python3.10/site-packages/librosa/core/notation.py
COPY packages/audio.py /usr/local/lib/python3.10/site-packages/librosa/core/audio.py
COPY packages/constantq.py /usr/local/lib/python3.10/site-packages/librosa/core/constantq.py
COPY packages/filters.py /usr/local/lib/python3.10/site-packages/librosa/filters.py
COPY packages/sequence.py /usr/local/lib/python3.10/site-packages/librosa/sequence.py
COPY utils.py /usr/local/lib/python3.10/site-packages/librosa/feature/utils.py
COPY packages/utils.py /usr/local/lib/python3.10/site-packages/librosa/util/utils.py
COPY packages/matching.py /usr/local/lib/python3.10/site-packages/librosa/util/matching.py
COPY packages/spectrum.py /usr/local/lib/python3.10/site-packages/librosa/core/spectrum.py
COPY packages/pitch.py /usr/local/lib/python3.10/site-packages/librosa/core/pitch.py
RUN chmod -R 777 /usr/local/lib/python3.10/site-packages/librosa

# Set the environment variable for the NUMBA cache directory
ENV NUMBA_CACHE_DIR=/tmp
# Ensure the tmp directory is writable
RUN chmod 777 /tmp

# Expose the port your app runs on
EXPOSE 7860

# Download UniDic for MeCab
RUN pip install unidic \
    && python -m unidic download

# Set the environment variable for Coqui TTS
ENV COQUI_TOS_AGREED=1

# Apply migrations
RUN python manage.py migrate

# Use Django's built-in server to serve the app
CMD ["python", "manage.py", "runserver", "0.0.0.0:7860"]