docker 为linux/arm 64上的节点安装gRPC工具

oalqel3c  于 2022-12-11  发布在  Docker
关注(0)|答案(1)|浏览(168)

Unable to install grpc-tools for node on linux/arm64.
Steps to reproduce,
with Dockerfile like

FROM node:latest

RUN apt-get update \
    && apt install -y curl ca-certificates curl gnupg \
    && npm -g install grpc-tools

CMD [ "grpc_tools_node_protoc" ]

The docker build docker buildx build --platform=linux/arm64 --load -t kameshsampath/protoc-node -f docker/Dockerfile.node.protoc . fails with an error like ,

#0 12.33 npm notice 
#0 12.33 npm notice New major version of npm available! 8.19.2 -> 9.1.1
#0 12.33 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.1.1>
#0 12.33 npm notice Run `npm install -g npm@9.1.1` to update!
#0 12.33 npm notice 
#0 12.33 npm ERR! code 1
#0 12.33 npm ERR! path /usr/local/lib/node_modules/grpc-tools
#0 12.33 npm ERR! command failed
#0 12.33 npm ERR! command sh -c -- node-pre-gyp install
#0 12.33 npm ERR! response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.3/linux-arm64.tar.gz
#0 12.33 npm ERR! node-pre-gyp info it worked if it ends with ok
#0 12.33 npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
#0 12.33 npm ERR! node-pre-gyp info using node@19.0.1 | linux | arm64
#0 12.33 npm ERR! node-pre-gyp info check checked for "/usr/local/lib/node_modules/grpc-tools/bin/grpc_tools.node" (not found)
#0 12.33 npm ERR! node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.3/linux-arm64.tar.gz
#0 12.33 npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.3/linux-arm64.tar.gz 
#0 12.33 npm ERR! node-pre-gyp ERR! install error 
#0 12.33 npm ERR! node-pre-gyp ERR! stack Error: response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.3/linux-arm64.tar.gz
#0 12.33 npm ERR! node-pre-gyp ERR! stack     at /usr/local/lib/node_modules/grpc-tools/node_modules/@mapbox/node-pre-gyp/lib/install.js:67:15
#0 12.33 npm ERR! node-pre-gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
#0 12.33 npm ERR! node-pre-gyp ERR! System Linux 5.15.49-linuxkit
#0 12.33 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/grpc-tools/node_modules/.bin/node-pre-gyp" "install"
#0 12.33 npm ERR! node-pre-gyp ERR! cwd /usr/local/lib/node_modules/grpc-tools
#0 12.33 npm ERR! node-pre-gyp ERR! node -v v19.0.1
#0 12.33 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
#0 12.34 npm ERR! node-pre-gyp ERR! not ok
#0 12.34 
#0 12.34 npm ERR! A complete log of this run can be found in:
#0 12.34 npm ERR!     /root/.npm/_logs/2022-11-13T13_28_37_399Z-debug-0.log
------
Dockerfile.node.protoc:3
--------------------
   2 |     
   3 | >>> RUN apt-get update \
   4 | >>>     && apt install -y curl ca-certificates curl gnupg \
   5 | >>>     && npm -g install grpc-tools
   6 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update     && apt install -y curl ca-certificates curl gnupg     && npm -g install grpc-tools" did not complete successfully: exit code: 1

The same build works well for linux/amd64 .
Any tips/clues to overcome this ?

kgqe7b3p

kgqe7b3p1#

arm 64(issue)没有预编译的二进制文件。因为GRPC-Tools只是构建工具,在运行时不是必需的,所以您可以在不同的体系结构上使用grpc-tools并复制编译的文件,或者您自己编译二进制文件。

相关问题