From 8370bc02513494a90e2322a0d4abdd3a98e382cb Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 4 Jul 2017 22:33:21 +0200 Subject: [PATCH] build and deploy with gitlab-ci --- .gitlab-ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..23d3851 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,35 @@ +image: docker:git +services: +- docker:dind + +stages: +- build +- test +- release + +variables: + TEST_IMAGE: registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:$CI_BUILD_REF_NAME + RELEASE_IMAGE: registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:latest + +before_script: + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com + +build: + stage: build + script: + - docker build -t $TEST_IMAGE . + - docker push $TEST_IMAGE + +test: + stage: test + script: + - docker run $TEST_IMAGE + +release: + stage: release + script: + - docker pull $TEST_IMAGE + - docker tag $TEST_IMAGE $RELEASE_IMAGE + - docker push $RELEASE_IMAGE + only: + - master