From 5c5f5b6230d70baacadfd439556d1151d084b5fe Mon Sep 17 00:00:00 2001 From: Adhityaa Date: Sat, 9 Jun 2018 11:11:13 +0530 Subject: [PATCH] .gitlab-ci.yml: add automated registry push on master --- .gitlab-ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab0095b..f6ad1b9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ stages: - build-src - build-docker - go-test + - docker-registry build-src: stage: build-src @@ -41,3 +42,17 @@ go-test: - cd api - (go get -v . || true) # TODO: remove this ugly hack - go test -v . + +docker-registry: + stage: docker-registry + image: docker:stable + services: + - docker:dind + only: + - master + before_script: + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com + script: + - docker pull registry.gitlab.com/commento/commento-ce:latest || true + - docker build --cache-from registry.gitlab.com/commento/commento-ce:latest --tag registry.gitlab.com/commento/commento-ce:latest . + - docker push registry.gitlab.com/commento/commento-ce:latest