Deploying node app using jenkins to a docker container

Using common CI/CD workflow with Jenkins and docker. Deploying app to a server without external internet connection, only jenkins has external internet, so i’m building up node app:

npm install

in a jenkins pipeline, then deploying it to a docker container.


FROM node:12

WORKDIR /var/www/cms

COPY . .

RUN chmod +x ./


CMD ["./"]

After npm install i’m copying whole directory to a docker container, that step takes approximately 15 minutes to finish up. What’s the best way to speed it up?

Source: StackOverflow