Optimised gitlab-ci.yml

This commit is contained in:
Deon George 2017-07-22 22:41:05 +10:00
parent ee6d32d981
commit 86d38b4ec1

View File

@ -7,8 +7,8 @@ stages:
variables: variables:
VERSION: latest VERSION: latest
CACHETAG: build CACHETAG: build
DOCKER_IMAGE: graytech/otrs
DOCKER_REGISTRY: registry.leenooks.net DOCKER_REGISTRY: registry.leenooks.net
DOCKER_IMAGE: ${DOCKER_REGISTRY}/graytech/otrs
DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375 DOCKER_HOST: tcp://${DOCKER_REGISTRY}-leenooks-ci-docker:2375
services: services:
@ -18,7 +18,7 @@ before_script:
- docker info - docker info
- docker version - docker version
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY} - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN ${DOCKER_REGISTRY}
- echo "CI_PROJECT_PATH ${CI_PROJECT_PATH} CI_COMMIT_TAG ${CI_COMMIT_TAG}" - echo "CI_PROJECT_PATH ${CI_PROJECT_PATH} CI_COMMIT_TAG ${CI_COMMIT_TAG} CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME}"
test: test:
stage: test stage: test
@ -33,11 +33,10 @@ test:
build: build:
stage: build stage: build
script: script:
- docker pull ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:latest - docker pull ${DOCKER_IMAGE}:${CACHETAG}
- docker build --cache-from ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:latest -t ${DOCKER_IMAGE}:${VERSION} -t ${DOCKER_IMAGE}:${CACHETAG} . - docker build --cache-from ${DOCKER_IMAGE}:${CACHETAG} -t ${DOCKER_IMAGE}:${VERSION} -t ${DOCKER_IMAGE}:${CACHETAG} .
- docker tag ${DOCKER_IMAGE}:${VERSION} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION} - docker push ${DOCKER_IMAGE}:${VERSION}
- docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${VERSION} - docker push ${DOCKER_IMAGE}:${CACHETAG}
- docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${CACHETAG}
tags: tags:
- docker - docker
only: only: