Download during Docker build

This commit is contained in:
Michael Hansen
2023-06-06 17:19:36 -05:00
parent ff88957218
commit 99f0936789
3 changed files with 20 additions and 31 deletions
+19 -28
View File
@@ -13,45 +13,36 @@ ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /build WORKDIR /build
# Build minimal version of espeak-ng RUN mkdir -p "lib/Linux-$(uname -m)"
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 ARG ONNXRUNTIME_VERSION='1.14.1'
COPY lib/onnxruntime-linux-*.tgz ./lib/ RUN if [ "${TARGETARCH}${TARGETVARIANT}" = 'amd64' ]; then \
RUN export ONNX_DIR="./lib/Linux-$(uname -m)" && \ ONNXRUNTIME_ARCH='x64'; \
mkdir -p "${ONNX_DIR}" && \ else \
tar -C "${ONNX_DIR}" \ ONNXRUNTIME_ARCH="$(uname -m)"; \
--strip-components 1 \ fi && \
-xvf "lib/onnxruntime-linux-${TARGETARCH}${TARGETVARIANT}.tgz" 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 # Build piper binary
COPY Makefile ./ COPY Makefile ./
COPY src/cpp/ ./src/cpp/ COPY src/cpp/ ./src/cpp/
RUN make no-pcaudio RUN make
# Do a test run # Do a test run
RUN /build/build/piper --help RUN ./build/piper --help
# Build .tar.gz to keep symlinks # Build .tar.gz to keep symlinks
WORKDIR /dist WORKDIR /dist
RUN mkdir -p piper && \ RUN mkdir -p piper && \
cp -d /usr/lib64/libespeak-ng.so* ./piper/ && \ cp -dR /build/build/*.so* /build/build/espeak-ng-data /build/build/piper ./piper/ && \
cp -dR /usr/share/espeak-ng-data ./piper/ && \
find /build/lib/ -name 'libonnxruntime.so.*' -exec cp -d {} ./piper/ \; && \
cp /build/build/piper ./piper/ && \
tar -czf "piper_${TARGETARCH}${TARGETVARIANT}.tar.gz" piper/ tar -czf "piper_${TARGETARCH}${TARGETVARIANT}.tar.gz" piper/
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
-2
View File
@@ -1,5 +1,3 @@
* *
!Makefile !Makefile
!src/cpp/ !src/cpp/
!lib/onnxruntime*.tgz
!lib/espeak-ng*.tar.gz
+1 -1
View File
@@ -5,7 +5,7 @@ LIB_DIR := lib/Linux-$(shell uname -m)
piper: piper:
mkdir -p build mkdir -p build
cd build && cmake ../src/cpp -DCMAKE_BUILD_TYPE=Release && make 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/ cp -a $(LIB_DIR)/onnxruntime/lib/*.so* build/
clean: clean: