stages: - build - docker cache: key: "$CI_COMMIT_REF_SLUG" paths: - ~/.npm/ build: stage: build image: alpine:latest before_script: - apk update && apk add git tar nodejs npm bash script: - npm install - npm ci - npm run build - npx semantic-release - find . -not -path "./node_modules/*" -type f -print0 | xargs -0 tar -czvf build-artifacts.tar.gz artifacts: paths: - build-artifacts.tar.gz only: - merge_requests - pushes docker: stage: docker image: docker:stable before_script: - docker info script: - apk add tar - tar -xzvf build-artifacts.tar.gz # Tag - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker build -t $CI_REGISTRY/scheduletogether/frontend:$CI_COMMIT_TAG . - docker push $CI_REGISTRY/scheduletogether/frontend:$CI_COMMIT_TAG # Latest - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker build -t $CI_REGISTRY/scheduletogether/frontend:latest . - docker push $CI_REGISTRY/scheduletogether/frontend:latest only: - tags