git » chasquid » commit 7814c64

gitlab: Upload images to dockerhub

author Alberto Bertogli
2020-03-23 01:13:11 UTC
committer Alberto Bertogli
2020-03-23 01:28:46 UTC
parent 29512f7e4f4ca7ced9b9be62c2ce437e97fb738f

gitlab: Upload images to dockerhub

It can be convenient to upload images to dockerhub for redundancy and
visibility, so this patch updates the gitlab CI configuration to do
that.

While at it, rename the stages for readability.

.gitlab-ci.yml +18 -5

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ac9083f..7687800 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,10 +1,10 @@
 
 stages:
   - test
-  - docker_image
+  - image
 
 # Integration test, using the module versions from the repository.
-integration_test:
+stable:
   stage: test
   image: docker:stable
   services:
@@ -16,7 +16,7 @@ integration_test:
     - docker run chasquid-test  make test
 
 # Integration test, using the latest module versions.
-integration_test_latest:
+latest:
   stage: test
   image: docker:stable
   services:
@@ -27,8 +27,9 @@ integration_test_latest:
     - docker run chasquid-test  env
     - docker run chasquid-test  make test
 
-image_build:
-  stage: docker_image
+# Build docker image, upload to gitlab registry.
+build_gitlab:
+  stage: image
   image: docker:stable
   services:
     - docker:dind
@@ -37,3 +38,15 @@ image_build:
     - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
     - docker build -t $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME -f docker/Dockerfile .
     - docker push $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
+
+# Build docker image, upload to dockerhub registry.
+build_dockerhub:
+  stage: image
+  image: docker:stable
+  services:
+    - docker:dind
+  script:
+    - docker info
+    - docker login -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD docker.io
+    - docker build -t index.docker.io/albertito/chasquid:$CI_BUILD_REF_NAME -f docker/Dockerfile .
+    - docker push index.docker.io/albertito/chasquid:$CI_BUILD_REF_NAME