Merge branch 'dev' of ssh://git.verdnatura.es:/var/lib/git/salix into dev
This commit is contained in:
commit
34e0537b64
|
@ -0,0 +1,75 @@
|
||||||
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
|
import groovy.json.*;
|
||||||
|
|
||||||
|
def image;
|
||||||
|
def branchName = "${env.BRANCH_NAME}";
|
||||||
|
def branchNameTest = "preprod";
|
||||||
|
def branchNameProd = "master";
|
||||||
|
def prefixDocker = "test";
|
||||||
|
def dockerNginxName = ["nginx", "-p 80:8080 --link test-auth:auth --link test-salix:salix --link test-client:client"]
|
||||||
|
def dockerAuthName = ["auth", "-p 3000:3000"]
|
||||||
|
def dockerSalixName = ["salix", "-p 3001:3001"]
|
||||||
|
def dockerClientName = ["client", "-p 3002:3002"]
|
||||||
|
|
||||||
|
def buildNumber = "${env.BUILD_NUMBER}";
|
||||||
|
|
||||||
|
def dockers = [dockerAuthName, dockerSalixName, dockerClientName, dockerNginxName]
|
||||||
|
|
||||||
|
node {
|
||||||
|
|
||||||
|
if (branchName == branchNameProd)
|
||||||
|
prefixDocker = "prod";
|
||||||
|
|
||||||
|
stage ('Checkout') {
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
|
||||||
|
stage ('build Project Salix'){
|
||||||
|
sh "gulp build"
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < dockers.size(); i++)
|
||||||
|
{
|
||||||
|
def element = dockers[i][0]
|
||||||
|
def ports = dockers[i][1]
|
||||||
|
|
||||||
|
stage ("docker ${element}")
|
||||||
|
{
|
||||||
|
stage ("Stopping ${prefixDocker}-${element} actual")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
def returnDocker = sh (script: "docker stop ${prefixDocker}-${element}", returnStdout: true).trim();
|
||||||
|
echo "${returnDocker}";
|
||||||
|
returnDocker = sh (script: "docker rm ${prefixDocker}-${element}", returnStdout: true).trim();
|
||||||
|
echo "${returnDocker}";
|
||||||
|
//returnDocker = sh (script: "docker rmi ${prefixDocker}-${element}:${buildNumber-3}", returnStdout: true).trim();
|
||||||
|
echo "borran ${prefixDocker}-${element}:${buildNumber-3}";
|
||||||
|
//echo "${returnDocker}";
|
||||||
|
}catch(Exception _){
|
||||||
|
echo "Error Stage Stopping"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ("Create Docker Image ${element}") {
|
||||||
|
dir("./services/${element}"){
|
||||||
|
stage ("Install modules service ${element}"){
|
||||||
|
if (fileExists('./package.json'))
|
||||||
|
sh "npm i"
|
||||||
|
}
|
||||||
|
stage("Build image ${element}"){
|
||||||
|
image = docker.build("${prefixDocker}-${element}:${buildNumber}", ".")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage ("Run Docker ${element}"){
|
||||||
|
image.run ("${ports} --name ${prefixDocker}-${element}")
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
stage('docker registry'){
|
||||||
|
docker.withServer('tcp://harbor.verdnatura.es','docker-registry')
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,3 +7,5 @@ WORKDIR /app
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
|
@ -7,3 +7,5 @@ WORKDIR /app
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|
||||||
|
EXPOSE 3002
|
|
@ -4,6 +4,8 @@ RUN rm /etc/nginx/nginx.conf
|
||||||
|
|
||||||
RUN rm /etc/nginx/conf.d/default.conf
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
COPY conf-prod.conf /etc/nginx/nginx.conf
|
COPY conf-prod.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
COPY build /etc/nginx
|
COPY static /usr/share/nginx/html
|
||||||
|
|
||||||
|
EXPOSE 8080
|
|
@ -25,15 +25,15 @@ http {
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/auth(?:/(.*))?$ {
|
location ~ ^/auth(?:/(.*))?$ {
|
||||||
proxy_pass http://192.168.99.100:3000/$1$is_args$args;
|
proxy_pass http://test-auth:3000/$1$is_args$args;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/salix(?:/(.*))?$ {
|
location ~ ^/salix(?:/(.*))?$ {
|
||||||
proxy_pass http://192.168.99.100:3001/$1$is_args$args;
|
proxy_pass http://test-salix:3001/$1$is_args$args;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/client(?:/(.*))?$ {
|
location ~ ^/client(?:/(.*))?$ {
|
||||||
proxy_pass http://192.168.99.100:3002/$1$is_args$args;
|
proxy_pass http://test-client:3002/$1$is_args$args;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,3 +7,5 @@ WORKDIR /app
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|
||||||
|
EXPOSE 3001
|
Loading…
Reference in New Issue