Merge branch 'push-only-master' into 'master'

Push images only on master

Closes #1 

See merge request !2
This commit is contained in:
Kamil Trzciński 2016-08-29 09:35:47 +00:00
commit 6ae7c5c40f

View file

@ -9,11 +9,28 @@ variables:
before_script:
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" registry.gitlab.com
.test_build: &test_build
stage: test
script:
# Hack to set an array in /bin/sh
# http://unix.stackexchange.com/a/137571
- set -- $CI_BUILD_NAME
- docker build -f "Dockerfile.$1" .
except:
- master
.build_and_deploy: &build_and_deploy
stage: build
script:
- docker build -t "$CI_REGISTRY_IMAGE:$CI_BUILD_NAME" -f "Dockerfile.$CI_BUILD_NAME" .
- docker push "$CI_REGISTRY_IMAGE:$CI_BUILD_NAME"
only:
- master
ruby-2.1 test: *test_build
ruby-2.2 test: *test_build
ruby-2.3 test: *test_build
www-gitlab-com test: *test_build
ruby-2.1: *build_and_deploy
ruby-2.2: *build_and_deploy