image: docker:latest stages: - test - build variables: BRANCH: plus VERSION: 7.1-fpm-${BRANCH} CACHETAG: build-${BRANCH} 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} tags: - docker only: - plus