2017-05-25 13:29:15 +00:00
|
|
|
image: docker:latest
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- build
|
|
|
|
|
|
|
|
variables:
|
2017-07-22 22:36:45 +00:00
|
|
|
VERSION: latest
|
|
|
|
CACHETAG: build
|
2017-05-25 13:29:15 +00:00
|
|
|
DOCKER_REGISTRY: registry.leenooks.net
|
2017-07-22 22:36:45 +00:00
|
|
|
DOCKER_IMAGE: ${DOCKER_REGISTRY}/${CI_PROJECT_PATH}
|
2017-05-25 13:29:15 +00:00
|
|
|
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 ${DOCKER_IMAGE}:${VERSION} .
|
|
|
|
- docker images
|
2017-07-22 22:36:45 +00:00
|
|
|
- echo "CI_PROJECT_PATH ${CI_PROJECT_PATH} CI_COMMIT_TAG ${CI_COMMIT_TAG} CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME}"
|
|
|
|
- echo "CI_REGISTRY ${CI_REGISTRY} CI_REGISTRY_IMAGE ${CI_REGISTRY_IMAGE} CI ${CI}"
|
2017-05-25 13:29:15 +00:00
|
|
|
only:
|
|
|
|
- debug
|
|
|
|
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
script:
|
|
|
|
- chmod 500 init
|
2017-07-22 22:36:45 +00:00
|
|
|
- docker pull ${DOCKER_IMAGE}:${CACHETAG}
|
|
|
|
- docker build --cache-from ${DOCKER_IMAGE}:${CACHETAG} -t ${DOCKER_IMAGE}:${VERSION} -t ${DOCKER_IMAGE}:${CACHETAG} .
|
|
|
|
- docker push ${DOCKER_IMAGE}:${VERSION}
|
|
|
|
- docker push ${DOCKER_IMAGE}:${CACHETAG}
|
2017-05-25 13:29:15 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
only:
|
|
|
|
- master
|