First off, I am totally new to deploying CICD builds.
I started with a successful setup of Jenkins X on an AWS EKS Cluster via this
I am able to run the pipeline via GitHub and builds successfully on a normal jx quickstart.
Problems arose when I started pushing my node express application.
On an alpine node base, my dockerfile looked like this:
FROM node:10.15.3-alpine RUN mkdir -p /app/node_modules && chown -R node:node /app WORKDIR /app COPY package*.json ./ RUN npm ci --prod FROM alpine:3.7 COPY --from=0 /usr/bin/node /usr/bin/ COPY --from=0 /usr/lib/libgcc* /usr/lib/libstdc* /usr/lib/ WORKDIR /app COPY --from=0 /app . EXPOSE 3000 CMD ["node", "server.js"]
And it terminated with an error:
Step 5/14 : RUN npm ci --prod ---> Running in c7f038a80dcc [91mnpm[0m[91m ERR! code EAI_AGAIN [0m[91mnpm ERR! errno EAI_AGAIN [0m[91mnpm ERR![0m[91m request to https://registry.npmjs.org/express/-/express-4.16.4.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443 [0mtime="2019-03-28T08:26:00Z" level=fatal msg="build failed: building [community]: build artifact: The command '/bin/sh -c npm ci --prod' returned a non-zero code: 1"
I tried using a non alpine base and this was how it looked:
FROM node:10-slim WORKDIR /usr/src/app COPY package*.json ./ RUN npm install COPY . . ENV PORT 3000 EXPOSE 3000 CMD ["npm", "start"]
But then, the problem was the build hangs (or is taking very long) when it hits the RUN npm install step.
I have scoured for possible answers and duplicate questions but to no avail. So I last resorted into asking it here.
I don’t have an idea of what’s going on honestly.