Update .gitlab-ci.yml

This commit is contained in:
Axel Olausson Holtenäs 2024-04-13 09:57:28 +00:00
parent 844df68ecd
commit 2d6e2cfe5e

View file

@ -26,28 +26,32 @@ build:
only: only:
- merge_requests - merge_requests
- pushes - pushes
- web
docker: docker:
stage: docker stage: docker
dependencies:
- build
image: image:
name: gcr.io/kaniko-project/executor:v1.14.0-debug name: gcr.io/kaniko-project/executor:v1.14.0-debug
entrypoint: [""] entrypoint: [""]
script: script:
- tar -xzvf build-artifacts.tar.gz - tar -xzvf build-artifacts.tar.gz
- echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USERNAME --password-stdin - |
# If pipeline runs on the default branch: Set tag to "latest"
if test "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH"; then
tag="latest"
# If pipeline is a tag pipeline, set tag to the git commit tag
elif test -n "$CI_COMMIT_TAG"; then
tag="$CI_COMMIT_TAG"
# Else set the tag to the git commit sha
else
tag="$CI_COMMIT_SHA"
fi
- |
- /kaniko/executor - /kaniko/executor
--context "${CI_PROJECT_DIR}" --context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile" --dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}" --destination "${CI_REGISTRY_IMAGE}:${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: # only:
# - tags # - tags