The following Dockerfile fails at npm install --production
in GCP Cloud Build
FROM node:10.15.3-slim
RUN sh -c 'apt-get update && apt-get install -y build-essential && apt-get install -y python'
COPY src /home/$user/
WORKDIR /home/$user
RUN npm install --production
CMD [ "npm", "start" ]
This is the package.json
{
"name": "generic-cloud-node-sql",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
},
"dependencies": {
"@google-cloud/bigquery": "^4.0.0",
"@google-cloud/storage": "^2.5.0",
"body-parser": "*",
"cron": "^1.7.1",
"dateformat": "^3.0.2",
"express": "*",
"form-data": "*",
"multer": "^1.4.1",
"njwt": "*",
"promise-mysql": "^3.3.1",
"request": "^2.88.0",
"request-ip": "^2.1.3",
"throw.js": "*",
"bcrypt": "^3.0.6",
"winston": "*",
"winston-gke": "*"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^5.2.0",
"chai-http": "*"
}
}
It fails when it tries to install bcrypt
with the message
Step #1: > bcrypt@3.0.6 install /home/node_modules/bcrypt Step #1: > node-pre-gyp install --fallback-to-build Step #1: Step #1: node-pre-gyp WARN Using request for node-pre-gyp https download Step #1: node-pre-gyp ERR: Completion callback never invoked. Step #1. node-pre-gyp ERR: System Linux 4.15:0-1044-gcp Step #1: node-pre-gyp ERR. command "/usr/local/bin/node" "/home/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" Step #1: node-pre-gyp ERR. cwd /home/node_modules/bcrypt Step #1. node-pre-gyp ERR: node -v v10.15:3 Step #1: node-pre-gyp ERR! node-pre-gyp -v v0.12.0 Step #1: node-pre-gyp ERR! This is a bug in `node-pre-gyp`. Step #1: node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
But the above Dockerfile and package.json works successfully when I run docker build
locally.
What could be the issue?
This looks like more like an issue with node-pre-gyp than with Cloud Build. I found this issue on GitHub that matches the issue that you are experiencing. It's definitely worth looking.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.