hasura / gitkube

Build and deploy docker images to Kubernetes using git push

Home Page:https://gitkube.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm install throws error

implicit-invocation opened this issue · comments

FROM node:12-alpine as build-deps
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm install
COPY . ./
RUN npm run build

FROM nginx:1.17.6-alpine
COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

My project is a simple create-react-app generated project.
When I do a git push, the remote failed at npm install.

remote: Step 5/11 : RUN npm install
remote:  ---> Running in d6c8449db0ae
remote: npm ERR! Maximum call stack size exceeded

If I remove package-lock.json, the error log is a little bit different

remote: Step 4/10 : RUN npm install
remote:  ---> Running in 795c3cbbe2eb
remote: npm ERR! code EAI_AGAIN
remote: npm ERR! errno EAI_AGAIN
remote: npm ERR! request to https://registry.npmjs.org/@testing-library%2freact failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org

Is there anything wrong with the DNS?

@implicit-invocation The issue is on your docker network. Docker bridge network sometimes can not connect internet. You can add flag network=host when running build

@hgiasac how can I modify Docker build command with gitkube?

My bad, it's just --build-args, I still don't know how to add --network host to the build command.

it seems that there is no configuration for that so I modify this file, build and push my own gitkubed to dockerhub and change the setup script to use my image.
--network=host fixed my problem.