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