author | Alberto Bertogli
<albertito@blitiri.com.ar> 2021-08-14 10:03:07 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2021-08-14 13:36:24 UTC |
parent | a3c06b6ee43705e96f97e43181ce4dbf87a088e5 |
.gitlab-ci.yml | +14 | -4 |
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e9aa0ff..782e718 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -76,8 +76,13 @@ gitlab: script: - docker info - 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 + - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME -f docker/Dockerfile . + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME + - | + if [ $CI_COMMIT_REF_NAME == master ]; then + docker tag $CI_REGISTRY_IMAGE:master $CI_REGISTRY_IMAGE:latest + docker push $CI_REGISTRY_IMAGE:latest + fi # Build docker image, upload to dockerhub registry. dockerhub: @@ -90,5 +95,10 @@ dockerhub: 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 + - docker build -t index.docker.io/albertito/chasquid:$CI_COMMIT_REF_NAME -f docker/Dockerfile . + - docker push index.docker.io/albertito/chasquid:$CI_COMMIT_REF_NAME + - | + if [ $CI_COMMIT_REF_NAME == master ]; then + docker tag index.docker.io/albertito/chasquid:master index.docker.io/albertito/chasquid:latest + docker push index.docker.io/albertito/chasquid:latest + fi