Compose & jenkinsfile fixes

This commit is contained in:
Juan Ferrer 2019-12-23 14:32:18 +01:00
parent aff56b7589
commit a252119884
2 changed files with 20 additions and 22 deletions

34
Jenkinsfile vendored
View File

@ -7,19 +7,11 @@ pipeline {
}
environment {
PROJECT_NAME = 'salix'
REGISTRY = 'registry.verdnatura.es'
PORT_MASTER_FRONT = '5002'
PORT_MASTER_BACK = '3001'
PORT_TEST_FRONT = '5001'
PORT_TEST_BACK = '4001'
TAG = "${env.BRANCH_NAME}"
}
stages {
stage('Checkout') {
steps {
script {
env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
if (!env.GIT_COMMITTER_EMAIL) {
env.COMMITTER_EMAIL = sh(
script: 'git --no-pager show -s --format="%ae"',
@ -29,16 +21,6 @@ pipeline {
env.COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL;
}
switch (env.BRANCH_NAME) {
case 'master':
env.PORT_FRONT = PORT_MASTER_FRONT
env.PORT_BACK = PORT_MASTER_BACK
break
case 'test':
env.PORT_FRONT = PORT_TEST_FRONT
env.PORT_BACK = PORT_TEST_BACK
break
}
switch (env.BRANCH_NAME) {
case 'master':
env.NODE_ENV = 'production'
@ -49,6 +31,22 @@ pipeline {
}
}
sh 'printenv'
configFileProvider([
configFile(fileId: "salix.env",
variable: 'SALIX_ENV')
]) {
sh 'cp "$SALIX_ENV" salix.env'
sh "source salix.env"
}
configFileProvider([
configFile(fileId: "salix.${env.NODE_ENV}.env",
variable: 'SALIX_LOCAL_ENV')
]) {
sh 'cp "$SALIX_LOCAL_ENV" salix.local.env'
sh "source salix.local.env"
}
}
}
stage('Install') {

View File

@ -1,7 +1,7 @@
version: '3.7'
services:
front:
image: registry.verdnatura.es/salix-front:${TAG}
image: registry.verdnatura.es/salix-front:${BRANCH_NAME}
build:
context: .
dockerfile: front/Dockerfile
@ -10,7 +10,7 @@ services:
deploy:
replicas: 3
back:
image: registry.verdnatura.es/salix-back:${TAG}
image: registry.verdnatura.es/salix-back:${BRANCH_NAME}
build: .
ports:
- ${PORT_BACK}:3000
@ -20,11 +20,11 @@ services:
- source: salix_datasources
target: /etc/salix/datasources.json
- source: salix-branch_datasources
target: /etc/salix/datasources.${NODE_ENV}.json
target: /etc/salix/datasources.local.json
- source: salix_print
target: /etc/salix/print.json
- source: salix-branch_print
target: /etc/salix/print.${NODE_ENV}.json
target: /etc/salix/print.local.json
volumes:
- /mnt/storage/pdfs:/var/lib/salix/pdfs
- /mnt/storage/dms:/var/lib/salix/dms