#814 Docker deployment stable

This commit is contained in:
Juan Ferrer 2019-01-02 02:02:29 +01:00
parent 93a86b5991
commit fff63f3e65
2 changed files with 15 additions and 4 deletions

15
Jenkinsfile vendored
View File

@ -2,7 +2,7 @@
switch (env.BRANCH_NAME) { switch (env.BRANCH_NAME) {
case 'test': case 'test':
env.NODE_ENV = 'test'; env.NODE_ENV = 'test'
break; break;
case 'master': case 'master':
env.NODE_ENV = 'production' env.NODE_ENV = 'production'
@ -30,7 +30,6 @@ node {
} }
stage ('Docker deployment') { stage ('Docker deployment') {
withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) { withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) {
env.COMPOSE_HTTP_TIMEOUT = 300
env.COMPOSE_PROJECT_NAME = 'salix' env.COMPOSE_PROJECT_NAME = 'salix'
env.DOCKER_TLS_VERIFY = 1 env.DOCKER_TLS_VERIFY = 1
@ -38,6 +37,18 @@ node {
env.COMPOSE_PROJECT_NAME = "${env.BRANCH_NAME}-salix" env.COMPOSE_PROJECT_NAME = "${env.BRANCH_NAME}-salix"
} }
switch (env.BRANCH_NAME) {
case 'master':
env.PORT = 5000
break;
case 'test':
env.PORT = 5001
break;
}
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2376';
sh "docker-compose up --build -d"
env.DOCKER_HOST = 'tcp://vch2.verdnatura.es:2376'; env.DOCKER_HOST = 'tcp://vch2.verdnatura.es:2376';
sh "docker-compose up --build -d" sh "docker-compose up --build -d"
} }

View File

@ -5,7 +5,7 @@ services:
context: . context: .
dockerfile: services/nginx/Dockerfile dockerfile: services/nginx/Dockerfile
ports: ports:
- 80:80 - ${PORT}:80
image: salix-app:latest image: salix-app:latest
restart: unless-stopped restart: unless-stopped
links: links:
@ -13,7 +13,7 @@ services:
api: api:
build: . build: .
environment: environment:
NODE_ENV: test NODE_ENV: ${NODE_ENV}
restart: unless-stopped restart: unless-stopped
image: salix-api:latest image: salix-api:latest
volumes: volumes: