node.jsdockeralpine-linuxkurento

Docker image build fails due to Kurento-Client dependency


Trying to build app's docker image using following Dockerfile & Dependencies

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"

This results in the following error:

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 

Image build works if last dependency is excluded. NODE v12.18.4, NPM 6.14.6 are installed. App working fine locally . WILL BE GREATLY THANKFUL FOR YOUR HELP.


Solution

  • Worked after changes to above dockerfile with : RUN apk add --update nodejs nodejs-npm RUN apk add git RUN apk add python2 and changing "kurento-client": "^6.15.0"

    kurento-client v6.9.0 complicates things as it needs node v8.17 that has to be installed via nvm installation first then git and python added