Cache our builds based on branches - part 2

This commit is contained in:
Deon George 2018-01-29 13:47:25 +11:00
parent e31d600b09
commit ea8f8a2334

View File

@ -7,7 +7,7 @@ stages:
variables: variables:
BRANCH: plus BRANCH: plus
VERSION: 7.1-fpm-${BRANCH} VERSION: 7.1-fpm-${BRANCH}
CACHETAG: build CACHETAG: build-${BRANCH}
DOCKER_REGISTRY: registry.leenooks.net DOCKER_REGISTRY: registry.leenooks.net
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375 DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
@ -35,7 +35,7 @@ build:
- docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true - 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 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}:${VERSION}
- docker push ${CI_REGISTRY_IMAGE}:${CACHETAG}-${BRANCH} - docker push ${CI_REGISTRY_IMAGE}:${CACHETAG}
tags: tags:
- docker - docker
only: only: