From a048a0c1391570c4e0c189f783bfad52fb3b90a0 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 9 Jul 2016 14:47:13 +1000 Subject: [PATCH] Updated .gitlab-ci file to use image from registry --- .gitlab-ci.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 23da5e8..8f6678e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,25 +4,26 @@ stages: - test - build -services: -- leenooks/ci-docker:dind - variables: VERSION: dind - DOCKER_HOST: tcp://leenooks-ci-docker:2375 + DOCKER_IMAGE: leenooks/ci-docker + DOCKER_REGISTRY: registry.leenooks.net + DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375 + +services: +- ${DOCKER_REGISTRY}/leenooks/ci-docker:dind before_script: -- env|sort -- test -n "${REGISTRY}" # Needs to be set in project -- test -n "${IMAGE}" # Needs to be set in project - docker info - docker version -- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${REGISTRY} +- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY} test: stage: test script: - - docker build -t ${IMAGE}:${VERSION} . + - cat /etc/hosts + - env|sort + - docker build -t ${DOCKER_IMAGE}:${VERSION} . - docker images only: - debug @@ -30,9 +31,9 @@ test: build: stage: build script: - - docker build -t ${IMAGE}:${VERSION} . - - docker tag ${IMAGE}:${VERSION} ${REGISTRY}/${IMAGE}:${VERSION} - - docker push ${REGISTRY}/${IMAGE}:${VERSION} + - docker build -t ${DOCKER_IMAGE}:${VERSION} . + - docker tag ${DOCKER_IMAGE}:${VERSION} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION} + - docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION} tags: - docker only: