File size: 1,890 Bytes
79894f5 801d18a 79894f5 114ae17 801d18a 79894f5 801d18a 79894f5 801d18a 79894f5 |
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# 使用 Python 3.8 基础镜像
FROM python:3.8-slim
# 设置环境变量,防止生成 pyc 文件
ENV PYTHONUNBUFFERED=1
# 安装必要的系统依赖和 OpenJTalk、MeCab
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
wget \
git \
libsndfile1 \
cmake \
libatlas-base-dev \
libtool \
automake \
autoconf \
sox \
ffmpeg \
# 安装 MeCab 及其开发库
mecab \
libmecab-dev \
mecab-ipadic-utf8 \
# 安装其他依赖
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# 安装 OpenJTalk
RUN mkdir -p /tmp/open_jtalk && \
cd /tmp/open_jtalk && \
wget -O open_jtalk.tar.gz "https://sourceforge.net/projects/open-jtalk/files/Open%20JTalk/open_jtalk-1.11/open_jtalk-1.11.tar.gz/download" && \
tar xzf open_jtalk.tar.gz && \
cd open_jtalk-1.11 && \
./configure --with-charset=utf8 && \
make && \
make install && \
ldconfig
# 设置环境变量
ENV LD_LIBRARY_PATH=/usr/local/lib
ENV PATH="/usr/local/bin:${PATH}"
# 创建工作目录
WORKDIR /app
# 克隆 GitHub 仓库
RUN git clone https://github.com/EXACG/AI-Sound-Web.git /app
# 安装 Python 依赖
RUN pip install --no-cache-dir -r requirements.txt
# 安装额外的 Python 包
RUN pip install --no-cache-dir \
uvicorn \
fastapi \
librosa \
soundfile \
unidecode \
phonemizer \
pypinyin \
pypinyin_dict \
jieba \
Cython
# 安装 pyopenjtalk
RUN pip install --no-cache-dir pyopenjtalk
# 下载模型文件
RUN mkdir -p /app/ys && \
wget -c "https://github.com/LemonFan-maker/Download-Models/releases/download/ys/ys.pth" -P /app/ys
# 编译 monotonic_align 模块
RUN cd /app/monotonic_align/ && python setup.py build_ext --inplace
# 暴露端口(根据您的应用程序设置端口)
EXPOSE 8080
# 运行应用程序
CMD ["python", "main.py"] |