php/.gitlab-ci.yml
Deon George e31d600b09 Added cleaning tmp AND moved ci build trigger to plus branch
Cache our builds based on branches - part 1
2018-01-29 13:43:29 +11:00

43 lines
921 B
YAML

image: docker:latest
stages:
- test
- build
variables:
BRANCH: plus
VERSION: 7.1-fpm-${BRANCH}
CACHETAG: build
DOCKER_REGISTRY: registry.leenooks.net
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
services:
- ${DOCKER_REGISTRY}/leenooks/ci-docker:dind
before_script:
- docker info
- docker version
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY}
test:
stage: test
script:
- cat /etc/hosts
- env|sort
- docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} .
- docker images
only:
- debug
build:
stage: build
script:
- 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}-${BRANCH}
tags:
- docker
only:
- plus