Deploy fixes

This commit is contained in:
Juan Ferrer 2019-01-08 13:46:02 +01:00
parent e5f4e8a01a
commit 4b67b80631
1 changed files with 6 additions and 9 deletions

15
Jenkinsfile vendored
View File

@ -4,18 +4,18 @@ node {
stage ('Checkout') { stage ('Checkout') {
checkout scm checkout scm
} }
stage ('Install Node dependencies') { stage ('Install') {
nodejs('node-lts') { nodejs('node-lts') {
sh "npm install --no-audit" sh "npm install --no-audit"
sh "gulp install" sh "gulp install"
} }
} }
stage ('Build project') { stage ('Build') {
nodejs('node-lts') { nodejs('node-lts') {
sh "gulp build" sh "gulp build"
} }
} }
stage ('Docker deployment') { stage ('Deploy') {
withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) { withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) {
switch (env.BRANCH_NAME) { switch (env.BRANCH_NAME) {
case 'master': case 'master':
@ -38,13 +38,10 @@ node {
break; break;
} }
env.COMPOSE_PROJECT_NAME = env.JOB_BASE_NAME
env.DOCKER_TLS_VERIFY = 1
env.TAG = env.NODE_ENV
if (env.BRANCH_NAME != 'master') { env.COMPOSE_PROJECT_NAME = env.JOB_NAME.replace('/', '-');
env.COMPOSE_PROJECT_NAME = "${env.BRANCH_NAME}-${env.COMPOSE_PROJECT_NAME}" env.DOCKER_TLS_VERIFY = 1
} env.TAG = env.BRANCH_NAME
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2376'; env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2376';
sh "docker-compose up --build -d" sh "docker-compose up --build -d"