stages:
  - build
#  - deploy

# build stage
build_app:
  image: node:alpine
  stage: build
  only:
    - main
  script:
    - npm install
    - npm run build:prod
  cache:
    paths:
      - node_modules/
  artifacts:
    paths:
      # build folder
      - dist/
#    expire_in: 1 hour
#
## production stage
#production:
#  stage: deploy
#  before_script:
#    - mkdir -p ~/.ssh
#    - echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
#    - chmod 600 ~/.ssh/id_rsa
#    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
#  script:
#    - scp -r dist/* username@server-ip-address:/var/www/html/