Split build job for branches and tags
Use CI_COMMIT_TAG for tag builds to preserve original tag format (v0.0.1 instead of v0-0-1)
This commit is contained in:
parent
4945897e8c
commit
a3febe3f2d
|
|
@ -24,7 +24,8 @@ variables:
|
|||
before_script:
|
||||
- echo "${REGISTRY_PASSWORD}" | docker login ${REGISTRY} -u ${REGISTRY_USER} --password-stdin
|
||||
|
||||
build:
|
||||
# Сборка веток
|
||||
build:branch:
|
||||
extends: .docker-build
|
||||
stage: build
|
||||
script:
|
||||
|
|
@ -32,4 +33,13 @@ build:
|
|||
- docker push ${IMAGE_NAME}:${CI_COMMIT_REF_SLUG}
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
|
||||
# Сборка тегов (v0.0.1 → registry/app:v0.0.1)
|
||||
build:tag:
|
||||
extends: .docker-build
|
||||
stage: build
|
||||
script:
|
||||
- docker build --pull -f ${DOCKERFILE} -t ${IMAGE_NAME}:${CI_COMMIT_TAG} ${DOCKER_CONTEXT}
|
||||
- docker push ${IMAGE_NAME}:${CI_COMMIT_TAG}
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
|
|
|
|||
Loading…
Reference in New Issue