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.

Dockerfile:

FROM node:12

WORKDIR /var/www/cms

COPY . .

RUN chmod +x ./strapi.sh

EXPOSE 1337

CMD ["./strapi.sh"]

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