image: node:alpine

stages:
  - install_dependencies
  - build_project

cache:
  key: "${CI_COMMIT_REF_SLUG}"
  paths:
    - node_modules/
    - build/

install_dependencies:
  stage: install_dependencies
  script:
    - npm ci

build_project:
  stage: build_project
  script:
    - npm ci
    - npm run build
  cache:
    key: "${CI_COMMIT_REF_SLUG}"
    paths:
      - node_modules/
    policy: pull
