Docker 由于 Kurento-Client 依赖性,图像构建失败

Docker image build fails due to Kurento-Client dependency

正在尝试使用以下 Dockerfile 和依赖项

构建应用程序的 docker 图像
FROM alpine
WORKDIR /usr/src/app
ARG PORT=3000
ENV PORT=$PORT
COPY package*.json ./
RUN apk add --no-cache  nodejs npm
RUN npm install 
COPY . .
EXPOSE $PORT
CMD [ "node", "server.js" ]
"dependencies": 
    "express": "^4.17.1",
    "minimist": "1.2.0",
    "socket.io": "^2.3.0",
    "kurento-client": "^6.9.0"

这会导致以下错误:

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/KurentoForks/reconnect-ws.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

如果排除了最后一个依赖项,图像构建工作。 NODE v12.18.4NPM 6.14.6 已安装。 应用程序在本地运行良好。非常感谢您的帮助。

在更改上述 dockerfile 后工作:运行 apk add --update nodejs nodejs-npm 运行 apk add git 运行 apk 添加 python2 并更改 "kurento-client": "^6.15.0"

kurento-client v6.9.0 使事情变得复杂,因为它需要节点 v8.17,必须先通过 nvm 安装然后添加 git 和 python