diff --git a/Jenkinsfile b/Jenkinsfile index 0cbfec622..ae8b0e27d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,6 +9,9 @@ env.NODE_ENV = branchName; env.BRANCH_NAME = branchName; env.TAG = "${env.BUILD_NUMBER}"; +if (branchName == "test") + env.NODE_ENV = "development"; + if (branchName == branchProduction) dockerHost = "tcp://172.16.255.29:2375"; @@ -25,35 +28,20 @@ node sh "npm install" } - stage ('build Project Salix'){ + stage ('build Project'){ sh "gulp build" } - stage ("docker") { stage ("Stopping/Removing Docker") { - try - { - sh "docker-compose stop" - sh "docker-compose rm -f" - }catch(Exception _){ - echo "Error Stopping/Removing dockers" - } + sh "docker-compose down --rmi all" } stage ("Generar dockers") { - stage ("build dockers") - { - sh "docker-compose build " - } - - stage ("up dockers") - { - sh "docker-compose up -d" - } + sh "docker-compose up -d --build" } } } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index dc0461cf3..4387b322c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,8 @@ services: container_name: "${BRANCH_NAME}-auth" image: "auth:${TAG}" build: - context: ./services/auth + context: ./services + dockerfile: /auth/Dockerfile expose: - "3000" ports: @@ -18,7 +19,8 @@ services: container_name: "${BRANCH_NAME}-salix" image: "salix:${TAG}" build: - context: ./services/salix + context: ./services + dockerfile: /salix/Dockerfile expose: - "3001" ports: @@ -30,7 +32,8 @@ services: container_name: "${BRANCH_NAME}-client" image: "client:${TAG}" build: - context: ./services/client + context: ./services + dockerfile: /client/Dockerfile expose: - "3002" ports: @@ -54,7 +57,8 @@ services: container_name: "${BRANCH_NAME}-production" image: "production:${TAG}" build: - context: ./services/production + context: ./services + dockerfile: /production/Dockerfile expose: - "3004" ports: diff --git a/services/auth/Dockerfile b/services/auth/Dockerfile index ecac7b8dc..43ea06188 100644 --- a/services/auth/Dockerfile +++ b/services/auth/Dockerfile @@ -1,6 +1,8 @@ FROM node:6.9.1 -COPY . /app +COPY ./auth /app + +COPY ./loopback /loopback WORKDIR /app @@ -8,6 +10,6 @@ RUN npm install RUN npm -g install pm2 -CMD ["pm2-docker", "."] +CMD ["pm2-docker", "./server/server.js"] EXPOSE 3000 diff --git a/services/client/Dockerfile b/services/client/Dockerfile index 9f923ab12..093176521 100644 --- a/services/client/Dockerfile +++ b/services/client/Dockerfile @@ -1,6 +1,8 @@ FROM node:6.9.1 -COPY . /app +COPY ./client /app + +COPY ./loopback /loopback WORKDIR /app @@ -8,6 +10,6 @@ RUN npm install RUN npm -g install pm2 -CMD ["pm2-docker", "."] +CMD ["pm2-docker", "./server/server.js"] EXPOSE 3002 \ No newline at end of file diff --git a/services/mailer/Dockerfile b/services/mailer/Dockerfile index dd9e2d200..9c1503ee2 100644 --- a/services/mailer/Dockerfile +++ b/services/mailer/Dockerfile @@ -8,6 +8,6 @@ RUN npm install RUN npm -g install pm2 -CMD ["pm2-docker", "."] +CMD ["pm2-docker", "./server/server.js"] EXPOSE 3003 diff --git a/services/mailer/package.json b/services/mailer/package.json index bb4b3d8a6..12aa4a0e4 100644 --- a/services/mailer/package.json +++ b/services/mailer/package.json @@ -10,7 +10,8 @@ "mustache": "^2.3.0", "mysql": "^2.13.0", "nodemailer": "^4.0.1", - "path": "^0.12.7" + "path": "^0.12.7", + "request": "^2.83.0" }, "repository": { "type": "git", diff --git a/services/production/Dockerfile b/services/production/Dockerfile index a15a314f9..ef90aeb04 100644 --- a/services/production/Dockerfile +++ b/services/production/Dockerfile @@ -1,6 +1,8 @@ FROM node:6.9.1 -COPY . /app +COPY ./production /app + +COPY ./loopback /loopback WORKDIR /app @@ -8,6 +10,6 @@ RUN npm install RUN npm -g install pm2 -CMD ["pm2-docker", "."] +CMD ["pm2-docker", "./server/server.js"] EXPOSE 3004 diff --git a/services/route/Dockerfile b/services/route/Dockerfile index 0a4749712..cbda24b7e 100644 --- a/services/route/Dockerfile +++ b/services/route/Dockerfile @@ -1,6 +1,8 @@ FROM node:6.9.1 -COPY . /app +COPY ./route /app + +COPY ./loopback /loopback WORKDIR /app @@ -8,6 +10,6 @@ RUN npm install RUN npm -g install pm2 -CMD ["pm2-docker", "."] +CMD ["pm2-docker", "./server/server.js"] EXPOSE 3005 diff --git a/services/salix/Dockerfile b/services/salix/Dockerfile index 2b97fd599..ed51d5ce4 100644 --- a/services/salix/Dockerfile +++ b/services/salix/Dockerfile @@ -1,6 +1,8 @@ FROM node:6.9.1 -COPY . /app +COPY ./salix /app + +COPY ./loopback /loopback WORKDIR /app @@ -8,6 +10,6 @@ RUN npm install RUN npm -g install pm2 -CMD ["pm2-docker", "."] +CMD ["pm2-docker", "./server/server.js"] EXPOSE 3001 \ No newline at end of file