image: docker:latest stages: - test - build variables: VERSION: 1.12a39-${CI_COMMIT_REF_NAME} CACHETAG: build-${CI_COMMIT_REF_NAME} DOCKER_HOST: tcp://docker:2375 services: - docker:dind before_script: - docker info - docker version - echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin test: stage: test script: - cat /etc/hosts - env|sort - docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} . - docker images tags: - docker only: - debug build: stage: build script: - if [ -f init ]; then chmod 500 init; fi - 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: - x86_64