Updated .gitlab-ci

This commit is contained in:
Deon George 2018-03-20 21:55:54 +11:00
parent b4fd617e7e
commit 05e533e0fd

View File

@ -6,24 +6,23 @@ stages:
variables: variables:
VERSION: "7" VERSION: "7"
DOCKER_IMAGE: leenooks/base CACHETAG: build
DOCKER_REGISTRY: registry.leenooks.net DOCKER_HOST: tcp://${CI_REGISTRY}-leenooks-ci-docker:2375
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
services: services:
- ${DOCKER_REGISTRY}/leenooks/ci-docker:dind - ${CI_REGISTRY}/leenooks/ci-docker:dind
before_script: before_script:
- docker info - docker info
- docker version - docker version
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY} - echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
test: test:
stage: test stage: test
script: script:
- cat /etc/hosts - cat /etc/hosts
- env|sort - env|sort
- docker build -t ${DOCKER_IMAGE}:${VERSION} . - docker build -t ${CI_REGISTRY_IMAGE}:${VERSION} .
- docker images - docker images
only: only:
- debug - debug
@ -31,9 +30,11 @@ test:
build: build:
stage: build stage: build
script: script:
- docker build -t ${DOCKER_IMAGE}:${VERSION} . - if [ -f init ]; then chmod 500 init; fi
- docker tag ${DOCKER_IMAGE}:${VERSION} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION} - docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true
- docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION} - 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: tags:
- docker - docker
only: only: