docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.41k stars 561 forks source link

npm network error inside docker build #1247

Closed MoonBite666 closed 4 weeks ago

MoonBite666 commented 1 month ago

I used this action in my Next.js repo, and the action alwayes failed in "build and push" process, npm install command. here's the Error message:

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm error code ECONNRESET
npm error syscall read
npm error errno -104
npm error network read ECONNRESET
npm error network This is a problem related to network connectivity.
npm error network In most cases you are behind a proxy or have bad network settings.
npm error network
npm error network If you are behind a proxy, please make sure that the
npm error network 'proxy' config is set properly.  See: 'npm help config'
npm error A complete log of this run can be found in: /root/.npm/_logs/2024-10-27T13_28_40_598Z-debug-0.log

I use the official Dockerfile of Next.js, and it could be done on my PC.

the Dockerfile is here,

the workflow yml file is here

so I wonder what can I do if the problem is caused by the action or Github itself? Many thanks for the help

MoonBite666 commented 4 weeks ago

Problem solved. The answer is that I used a mirror in CN and that reflects in the package-lock.json, which will be run on github server then triggered the npm network error.