Created
February 29, 2020 14:22
-
-
Save kwiss/3178039aa46f8cd0b530b1b60dbc9291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.base_register_stage: | |
stage: "Registration" | |
extends: .base_docker_image_stage | |
script: | |
- echo "$CI_JOB_TOKEN" | docker login $CI_REGISTRY -u gitlab-ci-token --password-stdin | |
- >- | |
if [[ -n "${CI_COMMIT_TAG}" ]]; then | |
export TAG=$(printf "${CI_COMMIT_TAG}" | sed "s/^v//") | |
echo "Register ${CI_COMMIT_TAG} tag as ${TAG}" | |
else | |
export TAG=$CI_COMMIT_REF_SLUG | |
echo "Register ${TAG} branch" | |
fi | |
- echo " | |
docker build | |
--cache-from ${IMAGE_NAME}:${CACHE_TAG} | |
-t ${IMAGE_NAME}:${CI_COMMIT_SHA} | |
-t ${IMAGE_NAME}:${TAG} | |
$DOCKER_BUILD_ARGS | |
$CONTEXT" | |
- docker build | |
--cache-from ${IMAGE_NAME}:${CACHE_TAG} | |
-t ${IMAGE_NAME}:${CI_COMMIT_SHA} | |
-t ${IMAGE_NAME}:${TAG} | |
$DOCKER_BUILD_ARGS | |
$CONTEXT | |
- docker push ${IMAGE_NAME}:${CI_COMMIT_SHA} | |
- docker push ${IMAGE_NAME}:${TAG} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment