From d2cf1954fc9a13e2ed270245ac6a94c71e5b104a Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 27 Jun 2023 16:31:02 +0200 Subject: [PATCH] fix: detect TARGETARCH if not present (#688) Signed-off-by: mudler --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb0e991..6e21da3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,11 +37,16 @@ RUN apt-get install -y libopenblas-dev RUN apt-get install -y libopencv-dev && \ ln -s /usr/include/opencv4/opencv2 /usr/include/opencv2 +# Use the variables in subsequent instructions +RUN echo "Target Architecture: $TARGETARCH" +RUN echo "Target Variant: $TARGETVARIANT" + # piper requirements # Use pre-compiled Piper phonemization library (includes onnxruntime) #RUN if echo "${GO_TAGS}" | grep -q "tts"; then \ RUN test -n "$TARGETARCH" \ - || (echo 'missing $TARGETARCH, either set this `ARG` manually, or run using `docker buildkit`' && false) + || (echo 'warn: missing $TARGETARCH, either set this `ARG` manually, or run using `docker buildkit`') + RUN curl -L "https://github.com/gabime/spdlog/archive/refs/tags/v${SPDLOG_VERSION}.tar.gz" | \ tar -xzvf - && \ mkdir -p "spdlog-${SPDLOG_VERSION}/build" && \ @@ -51,7 +56,7 @@ RUN curl -L "https://github.com/gabime/spdlog/archive/refs/tags/v${SPDLOG_VERSIO cmake --install . --prefix /usr && mkdir -p "lib/Linux-$(uname -m)" && \ cd /build && \ 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" | \ + curl -L "https://github.com/rhasspy/piper-phonemize/releases/download/v${PIPER_PHONEMIZE_VERSION}/libpiper_phonemize-${TARGETARCH:-$(go env GOARCH)}${TARGETVARIANT}.tar.gz" | \ tar -C "lib/Linux-$(uname -m)/piper_phonemize" -xzvf - && ls -liah /build/lib/Linux-$(uname -m)/piper_phonemize/ && \ cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/lib/. /lib64/ && \ cp -rfv /build/lib/Linux-$(uname -m)/piper_phonemize/lib/. /usr/lib/ && \