11# #########################################
2- FROM nvidia/cuda:12.3.2-cudnn9 -runtime-ubuntu22.04 AS build
2+ FROM nvidia/cuda:11.8.0-cudnn8 -runtime-ubuntu22.04 AS build
33
44ARG TARGETARCH=linux_x86_64
55ARG WYOMING_PIPER_VERSION="1.5.2"
6- ARG ONNXRUNTIME_VERSION="1.20.1"
6+ ARG PIPER_VERSION="1.2.0"
7+ ARG PIPER_PHONEMIZE_VERSION="1.1.0"
78
8- ENV LANG C.UTF-8
9+ ENV LANG= C.UTF-8
910ENV DEBIAN_FRONTEND=noninteractive
1011
1112RUN \
12- apt-get update && apt-get upgrade -y && \
13+ apt-get update &&\
1314 apt-get install -y --no-install-recommends \
1415 wget \
1516 curl \
1617 vim \
17- git \
1818 patch \
1919 python3 \
2020 python3-dev \
2121 python3-venv \
2222 python3-pip \
23+ ca-certificates \
24+ git \
2325 build-essential \
2426 cmake \
25- ca-certificates \
2627 pkg-config
2728
28- RUN \
29- mkdir -p /app/lib &&\
30- cd /tmp && wget -q https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-linux-x64-gpu-${ONNXRUNTIME_VERSION}.tgz &&\
31- tar xzf onnxruntime-linux-x64-gpu-${ONNXRUNTIME_VERSION}.tgz &&\
32- cp -rfv /tmp/onnxruntime-linux-x64-gpu-${ONNXRUNTIME_VERSION}/lib/lib* /app/lib &&\
33- cp -rfv /tmp/onnxruntime-linux-x64-gpu-${ONNXRUNTIME_VERSION}/include/* /usr/local/include/
34-
35- WORKDIR /build
29+ WORKDIR /app
3630
31+ COPY run.sh .
3732COPY patches/* /tmp/
33+
3834RUN \
39- git clone https://github.com/rhasspy/piper.git /build &&\
40- cd /build && patch -p0 --forward < /tmp/piper_CMakeLists.patch
35+ mkdir -p /app/lib /app/share /app/include/piper-phonemize &&\
36+ python3 -m venv /app &&\
37+ . /app/bin/activate && \
38+ \
39+ /app/bin/python3 -m pip install --no-cache-dir --force-reinstall --no-deps \
40+ "piper-tts==${PIPER_VERSION}" &&\
41+ \
42+ wget -q https://github.com/rhasspy/piper-phonemize/releases/download/v${PIPER_PHONEMIZE_VERSION}/piper_phonemize-${PIPER_PHONEMIZE_VERSION}-cp310-cp310-manylinux_2_28_x86_64.whl \
43+ -O /tmp/piper_phonemize-${PIPER_PHONEMIZE_VERSION}-py3-none-any.whl &&\
44+ \
45+ /app/bin/python3 -m pip install --no-cache-dir --force-reinstall --no-deps \
46+ /tmp/piper_phonemize-${PIPER_PHONEMIZE_VERSION}-py3-none-any.whl &&\
47+ \
48+ wget -q https://github.com/rhasspy/piper-phonemize/releases/download/v${PIPER_PHONEMIZE_VERSION}/libpiper_phonemize-amd64.tar.gz -O -| \
49+ tar -zxvf - -C /app &&\
50+ \
51+ mv /app/etc/* /app/share/ &&\
52+ mv /app/lib/espeak-ng-data /app/share/ &&\
53+ mv /app/include/*.hpp /app/include/piper-phonemize/ &&\
54+ mv /app/include/cpu_provider_factory.h /app/include/piper-phonemize/ &&\
55+ mv /app/include/provider_options.h /app/include/piper-phonemize/ &&\
56+ \
57+ LATEST_PIPER_VERSION=$(wget -q "https://api.github.com/repos/rhasspy/piper/releases/latest" -O -|awk '/tag_name/{print $4;exit}' FS='[""]' ) && \
58+ \
59+ wget "https://github.com/rhasspy/piper/releases/download/${LATEST_PIPER_VERSION}/piper_${TARGETARCH}.tar.gz" -O -|tar -zxvf - -C /usr/share &&\
60+ \
61+ /app/bin/python3 -m pip install --no-cache-dir \
62+ "wyoming-piper @ https://github.com/rhasspy/wyoming-piper/archive/refs/tags/v${WYOMING_PIPER_VERSION}.tar.gz"
4163
42- RUN ONNXRUNTIME_VERSION=${ONNXRUNTIME_VERSION} cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install
43- RUN cmake --build build --config Release
44- RUN cmake --install build
4564
46- WORKDIR /app
65+ WORKDIR /work
4766
48- RUN \
49- python3 -m venv /app &&\
50- mkdir /app/piper && cp -rfv /build/install/* /app/piper/ &&\
51- chmod 755 /app/piper/piper /app/piper/espeak-ng
67+ RUN git clone https://github.com/rhasspy/piper.git .
68+
69+ RUN cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install -DPIPER_PHONEMIZE_DIR=/app
70+ RUN cmake --build build --config Release
71+ RUN cmake --install build
5272
53- RUN /app/piper /piper --help
73+ RUN /work/install /piper --help
5474
55- COPY requirements.txt /app/
56- COPY run.sh /app/
75+ RUN mkdir -p /app/piper && \
76+ mv /work/install/lib*.so* /app/lib/ &&\
77+ cp -rf /work/install/* /app/piper/
5778
5879RUN \
59- . /app/bin/activate && \
60- /app/bin/python3 -m pip install --no-cache-dir \
61- -r /app/requirements.txt \
62- &&\
63- \
64- /app/bin/python3 -m pip install --no-cache-dir \
65- "wyoming-piper @ https://github.com/rhasspy/wyoming-piper/archive/refs/tags/v${WYOMING_PIPER_VERSION}.tar.gz"
80+ wget -q https://github.com/microsoft/onnxruntime/releases/download/v1.14.1/onnxruntime-linux-x64-gpu-1.14.1.tgz -O - | \
81+ tar -zxvf - -C /tmp/ &&\
82+ cp /tmp/onnxruntime-linux-x64-gpu-1.14.1/lib/* /app/lib/
6683
6784RUN \
6885 cd /app/lib/python3.10/site-packages/wyoming_piper/; \
69- for file in /tmp/wyoming_piper*.diff;do patch -p0 --forward < $file;done; \
70- cp /build/install/lib*.so* /app/lib/
86+ for file in /tmp/wyoming_piper*.diff;do patch -p0 --forward < $file;done;
7187
7288# #########################################
73- FROM nvidia/cuda:12.3.2-cudnn9 -runtime-ubuntu22.04 AS dist
89+ FROM nvidia/cuda:11.8.0-cudnn8 -runtime-ubuntu22.04 AS dist
7490
7591ENV PYTHONUNBUFFERED=1
92+ ENV PATH="/bin:$PATH"
7693
7794RUN \
7895 mkdir -p /data /app &&\
79- apt-get update && apt-get upgrade -y && \
96+ apt-get update &&\
8097 apt-get install -y --no-install-recommends \
8198 wget \
8299 curl \
83100 vim \
84101 python3 \
85- python3-dev \
86- python3-venv \
87102 python3-pip \
88103 ca-certificates
89104
@@ -92,8 +107,6 @@ RUN rm -rf /root/.cache/pip /var/lib/apt/lists/*
92107WORKDIR /app
93108COPY --from=build /app .
94109
95- RUN ln -s /app/piper/espeak-ng-data /usr/share/espeak-ng-data
96-
97110EXPOSE 10200
98111
99112ENTRYPOINT ["bash" , "/app/run.sh" ]
0 commit comments