Skip to content

Commit

Permalink
Merge pull request #55 from kepstin/BBBSL-39
Browse files Browse the repository at this point in the history
BBBSL-39: Build tag images and push 'latest' tag from gitlab-ci
  • Loading branch information
ffdixon authored Feb 28, 2020
2 parents f76abe2 + 47eaa57 commit 18d35c8
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,29 @@ docker:
- docker push $CI_REGISTRY_IMAGE/nginx:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE/nginx:git-$CI_COMMIT_SHA

publish_dockerhub:
.dockerhub:
extends: .docker
stage: publish
interruptible: false
resource_group: dockerhub
interruptible: false
stage: publish
variables:
GIT_STRATEGY: none
only:
variables:
- $DOCKERHUB_USER
- $DOCKERHUB_PASSWORD
before_script:
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD

publish_dockerhub:
extends: .dockerhub
only:
refs:
- master
variables:
- $DOCKERHUB_IMAGE
- tags
script:
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD
- docker pull $CI_REGISTRY_IMAGE/api:git-$CI_COMMIT_SHA
- docker pull $CI_REGISTRY_IMAGE/poller:git-$CI_COMMIT_SHA
- docker pull $CI_REGISTRY_IMAGE/recording-importer:git-$CI_COMMIT_SHA
Expand All @@ -147,3 +156,23 @@ publish_dockerhub:
- docker push $DOCKERHUB_IMAGE:$CI_COMMIT_REF_SLUG-poller
- docker push $DOCKERHUB_IMAGE:$CI_COMMIT_REF_SLUG-recording-importer
- docker push $DOCKERHUB_IMAGE:$CI_COMMIT_REF_SLUG-nginx

publish_dockerhub_latest:
extends: .dockerhub
only:
refs:
- tags
when: manual
script:
- docker pull $CI_REGISTRY_IMAGE/api:git-$CI_COMMIT_SHA
- docker pull $CI_REGISTRY_IMAGE/poller:git-$CI_COMMIT_SHA
- docker pull $CI_REGISTRY_IMAGE/recording-importer:git-$CI_COMMIT_SHA
- docker pull $CI_REGISTRY_IMAGE/nginx:git-$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE/api:git-$CI_COMMIT_SHA $DOCKERHUB_IMAGE:latest-api
- docker tag $CI_REGISTRY_IMAGE/poller:git-$CI_COMMIT_SHA $DOCKERHUB_IMAGE:latest-poller
- docker tag $CI_REGISTRY_IMAGE/recording-importer:git-$CI_COMMIT_SHA $DOCKERHUB_IMAGE:latest-recording-importer
- docker tag $CI_REGISTRY_IMAGE/nginx:git-$CI_COMMIT_SHA $DOCKERHUB_IMAGE:latest-nginx
- docker push $DOCKERHUB_IMAGE:latest-api
- docker push $DOCKERHUB_IMAGE:latest-poller
- docker push $DOCKERHUB_IMAGE:latest-recording-importer
- docker push $DOCKERHUB_IMAGE:latest-nginx

0 comments on commit 18d35c8

Please sign in to comment.