50 lines
1.4 KiB
Groovy
50 lines
1.4 KiB
Groovy
#!/usr/bin/env groovy
|
|
|
|
env.COMPOSER_HTTP_TIMEOUT = 300;
|
|
|
|
switch (env.BRANCH_NAME) {
|
|
case 'test':
|
|
env.NODE_ENV = 'test';
|
|
env.salixHost = env.testSalixHost;
|
|
env.salixPort = env.testSalixPort;
|
|
break;
|
|
case 'master':
|
|
env.NODE_ENV = 'production'
|
|
env.salixHost = env.productionSalixHost;
|
|
env.salixPort = env.productionSalixPort;
|
|
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2375';
|
|
break;
|
|
}
|
|
|
|
node {
|
|
//env.NODEJS_HOME = "${tool 'node-8.12.0'}"
|
|
// on linux / mac
|
|
//env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
|
|
|
stages {
|
|
stage ('Print environment variables') {
|
|
echo "Branch ${env.BRANCH_NAME}, build number ${env.BUILD_NUMBER}, environment ${env.NODE_ENV}"
|
|
}
|
|
stage ('Checkout') {
|
|
checkout scm
|
|
}
|
|
stage ('Install Node dependencies') {
|
|
nodejs('node-8.12.0') {
|
|
sh "npm install --only=prod"
|
|
sh "npm install --only=dev"
|
|
sh "gulp install"
|
|
}
|
|
}
|
|
stage ('Build project') {
|
|
nodejs('node-8.12.0') {
|
|
sh "gulp build"
|
|
}
|
|
}
|
|
stage ('Generating new dockers') {
|
|
sh "docker build -t vn-loopback:latest ./services/loopback/"
|
|
sh "docker-compose up -d --build"
|
|
sh "docker image prune -f"
|
|
}
|
|
}
|
|
}
|