My situation
I am currently investigating a problem with building a Dockerfile on our company-servers. We are behind a http-proxy and use Ubuntu 16.04 LTS.
The Problem
Building this Dockerfile:
FROM node:10 AS build-stage
WORKDIR /app
# to use cache on node_moduless
COPY package.json ./
RUN npm set http-proxy http://mycompanyproxy.com:3128
RUN npm set https-proxy http://mycompanyproxy.com:3128
RUN npm cache clean --force
RUN npm install --verbose
COPY . .
RUN npm run build:prod
FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=build-stage /app/dist/ /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
takes about 15-20 minutes to complete. On the server alone, this would be no problem but we are using a CI/CD pipeline to build this file. On this pipeline we are running into timeout-problems because of this.
What have I done
To tackle this problem I tried building the Dockerfile on several different systems. The result was, that every machine that did not have a proxy to connect to the internet has had absolutely no problem building the file in only a fraction of time.
However, I cannot determine the reason why npm would take so much time only because it is behind a proxy...
Could you please help me here?
I included the output of the docker-build command here:
Part 1: https://pastebin.com/pEdNnQUv\
Part 2: https://pastebin.com/yZ0UXTNq