AI-Sound / Dockerfile
Menyu's picture
Update Dockerfile
801d18a verified
raw
history blame
1.89 kB
# 使用 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"]