How to avoid install all libs everytime a build is made

Hi

First of all i am new to all this stuff , so please bare over with me.

Everytime I commit a project , and building the project via yml , it need to
install the

  • npm install -g @angular/cli
  1. is not a better solution so I do not need to run that step at each build ??
  2. are there a way where i can push my ‘dist’ directory direct to server without need to build on gitlab server.

my yml file:

image: node:latest
pages:
cache:
paths:
- node_modules/
script:
- npm install
- npm install -g @angular/cli
- ng build
- sed -i ‘s/base href="/base href="/Firstprogram-cli/g’ dist/index.html
- mv dist public

artifacts:
paths:
- public
only:

  • master

Best Regards
Kim

Use this instead:

image: teracy/angular-cli

pages:
stage: deploy
cache:
paths:
- node_modules/
script:

  • npm install
  • ng build -prod -aot
  • mv dist/ public/
    artifacts:
    paths:
    • public
      only:
  • master