stages: - build - docker variables: NODE_VERSION: "20" cache: key: "$CI_COMMIT_REF_SLUG" paths: - ~/.npm/ build: stage: build image: alpine:latest before_script: - apk update && apk add git tar nodejs npm - npm ci script: - 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: name: gcr.io/kaniko-project/executor:v1.14.0-debug entrypoint: [""] script: - apk add tar - tar -xzvf build-artifacts.tar.gz - echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USERNAME --password-stdin - /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}" - /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "zyner/xyter:${CI_COMMIT_TAG}" # Tag name - docker tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG} $CI_REGISTRY_IMAGE:latest - docker tag zyner/xyter:$CI_COMMIT_TAG $CI_REGISTRY_IMAGE:latest # Latest - docker push zyner/xyter:latest - docker push $CI_REGISTRY_IMAGE:latest # only: # - tags