2022-01-21 23:23:55 +00:00
|
|
|
stages:
|
2022-01-21 23:50:12 +00:00
|
|
|
- test
|
2022-01-21 23:25:59 +00:00
|
|
|
- build
|
2022-01-21 23:23:55 +00:00
|
|
|
- release
|
|
|
|
|
|
|
|
# Test if the image can be built
|
|
|
|
test:build:
|
2022-01-21 23:25:59 +00:00
|
|
|
stage: build
|
2022-01-21 23:23:55 +00:00
|
|
|
tags:
|
|
|
|
- build
|
2022-01-21 23:50:12 +00:00
|
|
|
image: docker:stable
|
2022-01-21 23:23:55 +00:00
|
|
|
script:
|
|
|
|
- docker build .
|
|
|
|
interruptible: true
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
|
|
|
|
# Push images of tags to private registry
|
|
|
|
release:image:
|
2022-01-21 23:50:12 +00:00
|
|
|
stage: release
|
2022-01-21 23:23:55 +00:00
|
|
|
tags:
|
|
|
|
- build
|
2022-01-21 23:25:59 +00:00
|
|
|
- release
|
2022-01-21 23:50:12 +00:00
|
|
|
image: docker:stable
|
2022-01-21 23:23:55 +00:00
|
|
|
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
|