stages: - test - build - release # Test if the image can be built test:build: stage: build tags: - build image: docker:stable script: - docker build . interruptible: true only: - master # Push images of tags to private registry release:image: stage: release tags: - build - release image: docker:stable 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