Download during Docker build

pull/100/head
Michael Hansen 1 year ago
parent ff88957218
commit 99f0936789

@ -13,45 +13,36 @@ ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /build
# Build minimal version of espeak-ng
ADD lib/espeak-ng-1.52-patched.tar.gz ./
RUN cd espeak-ng && \
./autogen.sh && \
./configure \
--without-pcaudiolib \
--without-klatt \
--without-speechplayer \
--without-mbrola \
--without-sonic \
--with-extdict-cmn \
--prefix=/usr && \
make -j8 src/espeak-ng src/speak-ng && \
make && \
make install
# Copy onnxruntime library
COPY lib/onnxruntime-linux-*.tgz ./lib/
RUN export ONNX_DIR="./lib/Linux-$(uname -m)" && \
mkdir -p "${ONNX_DIR}" && \
tar -C "${ONNX_DIR}" \
--strip-components 1 \
-xvf "lib/onnxruntime-linux-${TARGETARCH}${TARGETVARIANT}.tgz"
RUN mkdir -p "lib/Linux-$(uname -m)"
ARG ONNXRUNTIME_VERSION='1.14.1'
RUN if [ "${TARGETARCH}${TARGETVARIANT}" = 'amd64' ]; then \
ONNXRUNTIME_ARCH='x64'; \
else \
ONNXRUNTIME_ARCH="$(uname -m)"; \
fi && \
curl -L "https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-linux-${ONNXRUNTIME_ARCH}-${ONNXRUNTIME_VERSION}.tgz" | \
tar -C "lib/Linux-$(uname -m)" -xzvf - && \
mv "lib/Linux-$(uname -m)"/onnxruntime-* \
"lib/Linux-$(uname -m)/onnxruntime"
ARG PIPER_PHONEMIZE_VERSION='1.0.0'
RUN mkdir -p "lib/Linux-$(uname -m)/piper_phonemize" && \
curl -L "https://github.com/rhasspy/piper-phonemize/releases/download/v${PIPER_PHONEMIZE_VERSION}/libpiper_phonemize-${TARGETARCH}${TARGETVARIANT}.tar.gz" | \
tar -C "lib/Linux-$(uname -m)/piper_phonemize" -xzvf -
# Build piper binary
COPY Makefile ./
COPY src/cpp/ ./src/cpp/
RUN make no-pcaudio
RUN make
# Do a test run
RUN /build/build/piper --help
RUN ./build/piper --help
# Build .tar.gz to keep symlinks
WORKDIR /dist
RUN mkdir -p piper && \
cp -d /usr/lib64/libespeak-ng.so* ./piper/ && \
cp -dR /usr/share/espeak-ng-data ./piper/ && \
find /build/lib/ -name 'libonnxruntime.so.*' -exec cp -d {} ./piper/ \; && \
cp /build/build/piper ./piper/ && \
cp -dR /build/build/*.so* /build/build/espeak-ng-data /build/build/piper ./piper/ && \
tar -czf "piper_${TARGETARCH}${TARGETVARIANT}.tar.gz" piper/
# -----------------------------------------------------------------------------

@ -1,5 +1,3 @@
*
!Makefile
!src/cpp/
!lib/onnxruntime*.tgz
!lib/espeak-ng*.tar.gz

@ -5,7 +5,7 @@ LIB_DIR := lib/Linux-$(shell uname -m)
piper:
mkdir -p build
cd build && cmake ../src/cpp -DCMAKE_BUILD_TYPE=Release && make
cp -aR $(LIB_DIR)/piper_phonemize/espeak-ng-data $(LIB_DIR)/piper_phonemize/lib/*.so* build/
cp -aR $(LIB_DIR)/piper_phonemize/lib/espeak-ng-data $(LIB_DIR)/piper_phonemize/lib/*.so* build/
cp -a $(LIB_DIR)/onnxruntime/lib/*.so* build/
clean:

Loading…
Cancel
Save