Docker deploy

This commit is contained in:
Juan Ferrer 2020-01-31 21:20:08 +01:00
parent 42f7f7bcfd
commit 4edd93b85e
1 changed files with 13 additions and 0 deletions

13
vars/dockerDeploy.groovy Normal file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env groovy
def call() {
environment {
CREDS = credentials('docker-registry')
}
steps {
sh 'docker-compose build --parallel'
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh 'docker-compose push'
sh 'docker stack deploy --with-registry-auth --prune --compose-file docker-compose.yml $PROJECT_NAME'
}
}