34 lines
828 B
YAML
34 lines
828 B
YAML
|
stages:
|
||
|
- test
|
||
|
- release
|
||
|
|
||
|
# Test if the image can be built
|
||
|
test:build:
|
||
|
stage: test
|
||
|
tags:
|
||
|
- test
|
||
|
- build
|
||
|
image: docker:latest
|
||
|
script:
|
||
|
- docker build .
|
||
|
interruptible: true
|
||
|
only:
|
||
|
- master
|
||
|
|
||
|
# Push images of tags to private registry
|
||
|
release:image:
|
||
|
stage: release
|
||
|
tags:
|
||
|
- release
|
||
|
- build
|
||
|
image: docker:latest
|
||
|
script:
|
||
|
- docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_HOST}"
|
||
|
- echo "Building image..."
|
||
|
- docker build -t "${DOCKER_REGISTRY_HOST}"/gkcld/unbound:"${CI_COMMIT_TAG}" -t "${DOCKER_REGISTRY_HOST}"/gkcld/unbound:latest .
|
||
|
- echo "Pushing tags..."
|
||
|
- docker push "${DOCKER_REGISTRY_HOST}"/gkcld/unbound:"${CI_COMMIT_TAG}"
|
||
|
- docker push "${DOCKER_REGISTRY_HOST}"/gkcld/unbound:latest
|
||
|
interruptible: false
|
||
|
only:
|
||
|
- tags
|