From 858ce40a1ade4c4583e5f087debac139b5e09043 Mon Sep 17 00:00:00 2001 From: Lakshan Perera Date: Thu, 15 Feb 2024 11:45:37 +1100 Subject: [PATCH] fix: installation of onnx runtime in x86 plaforms --- Dockerfile | 3 +-- scripts/install_onnx.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 scripts/install_onnx.sh diff --git a/Dockerfile b/Dockerfile index c75d9779..8cc29545 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry,id=${TARGETPLATFORM} --m GIT_V_TAG=${GIT_V_VERSION} cargo build --release && \ cargo strip && \ mv /usr/src/edge-runtime/target/release/edge-runtime /root -RUN curl -O https://registry.npmjs.org/onnxruntime-node/-/onnxruntime-node-${ONNXRUNTIME_VERSION}.tgz && tar zxvf onnxruntime-node-${ONNXRUNTIME_VERSION}.tgz && \ - mv ./package/bin/napi-v3/$TARGETPLATFORM/libonnxruntime.so.${ONNXRUNTIME_VERSION} /root/libonnxruntime.so +RUN ./scripts/install_onnx.sh $ONNXRUNTIME_VERSION $TARGETPLATFORM /root/libonnxruntime.so FROM debian:bookworm-slim diff --git a/scripts/install_onnx.sh b/scripts/install_onnx.sh new file mode 100755 index 00000000..54d189da --- /dev/null +++ b/scripts/install_onnx.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +curl -O https://registry.npmjs.org/onnxruntime-node/-/onnxruntime-node-$1.tgz && tar zxvf onnxruntime-node-$1.tgz + +if [ "$2" == "linux/arm64" ]; then + mv ./package/bin/napi-v3/linux/arm64/libonnxruntime.so.$1 $3 +else + mv ./package/bin/napi-v3/linux/x64/libonnxruntime.so.$1 $3 +fi