...
 
Commits (2)
clone:
git:
image: plugins/git
volumes:
- /etc/hosts:/etc/hosts:ro
pipeline:
build:
image: docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/hosts:/etc/hosts:ro
commands:
- docker build -t docker.fricouv.eu/vfricou/glpi:latest .
when:
branch: master
docker:
image: plugins/docker
secrets: [ docker_username, docker_password ]
registry: docker.fricouv.eu
repo: docker.fricouv.eu/vfricou/glpi
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /etc/hosts:/etc/hosts:ro
tags:
- beta
- 9.3-beta
when:
branch: master
notify:
image: drillster/drone-email
secrets: [ email_username, email_password ]
volumes:
- /etc/hosts:/etc/hosts:ro
from: no-reply@fricouv.eu
host: mail.fricouv.local
recipient:
- vincent@fricouv.eu
skip_verify: true
when:
status:
- success
- failure
......@@ -25,12 +25,6 @@ release-image:latest:
only:
- master
deploy:swarm:
stage: deploy
image: kroniak/ssh-client:latest
script:
- ssh ${CI_SWARM_DEPLOY_USER}@${CI_SWARM_DEPLOY_MANAGER} cd ${SWARM_REPO_PATH} && git pull && docker service rm ${SWARM_SVC_NAME} && docker stack deploy -c docker-compose.yml ${SWARM_SVC_NAME} --with-registry-auth
release-image:tags:
stage: release
script:
......@@ -38,4 +32,15 @@ release-image:tags:
- docker push $CONTAINER_RELEASE_IMAGE_TAG
only:
- tags
\ No newline at end of file
deploy:swarm:
stage: deploy
image: debian:latest
script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- mkdir -p ~/.ssh
- echo "${CI_SWARM_DEPLOY_SSHKEY}" > ~/.ssh/id_rsa
- chmod 400 ~/.ssh/id_rsa
- chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- ssh -i ~/.ssh/id_rsa ${CI_SWARM_DEPLOY_USER}@${CI_SWARM_DEPLOY_MANAGER} "docker service update ${SWARM_SVC_NAME} --replicas 2 && docker service update ${SWARM_SVC_NAME} --image ${CONTAINER_RELEASE_IMAGE} && docker service update ${SWARM_SVC_NAME} --replicas 1"
\ No newline at end of file