Skip to content

Instantly share code, notes, and snippets.

@hansamann
Created April 23, 2018 14:15
Show Gist options
  • Save hansamann/0b22b9ebad4186406f01022859cd9eed to your computer and use it in GitHub Desktop.
Save hansamann/0b22b9ebad4186406f01022859cd9eed to your computer and use it in GitHub Desktop.
Deploy Stage
deploy:
stage: deploy
dependencies: []
variables:
GIT_STRATEGY: none
tags:
- tablemaster
script:
- echo ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
- TABLESERVICE=$(docker service ls --filter name=tableservice --quiet)
- |
if [ "$TABLESERVICE" == "" ]
then
docker service create \
--name tableservice \
--with-registry-auth \
--constraint 'node.labels.type==table' \
--publish mode=host,published=80,target=8080 \
--mode=global \
--mount type=bind,source=/sys,target=/sys \
${CI_REGISTRY_IMAGE}:${DEPLOY_TAG}
else
docker service update \
--with-registry-auth \
--image ${CI_REGISTRY_IMAGE}:${DEPLOY_TAG} \
--force tableservice\
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment