From fee2424f689e316e0d30bdc5f34a5db38cfbd0eb Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 13 Dec 2017 22:01:01 +1100 Subject: [PATCH] Updated CI to take advantage of cache building --- .gitlab-ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d26e0f4..5c7a5d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ stages: variables: VERSION: 7.1-fpm-plus - DOCKER_IMAGE: leenooks/php + CACHETAG: build DOCKER_REGISTRY: registry.leenooks.net DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375 @@ -23,7 +23,7 @@ test: script: - cat /etc/hosts - env|sort - - docker build -t ${DOCKER_IMAGE}:${VERSION} . + - docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} . - docker images only: - debug @@ -31,9 +31,10 @@ test: build: stage: build script: - - docker build -t ${DOCKER_IMAGE}:${VERSION} . - - docker tag ${DOCKER_IMAGE}:${VERSION} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION} - - docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION} + - docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true + - docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} . + - docker push ${CI_REGISTRY_IMAGE}:${VERSION} + - docker push ${CI_REGISTRY_IMAGE}:${CACHETAG} tags: - docker only: