diff --git a/Dockerfile b/Dockerfile index 098642bfb..3018fe2d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,5 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY . /app -COPY ../loopback /loopback - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] - -EXPOSE 3000 diff --git a/Jenkinsfile b/Jenkinsfile index dd5112b0f..a47499cf3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,6 +29,7 @@ node { } stage ('Install client Node dependencies') { sh "npm install" + sh "gulp install" } stage ('Build project') { sh "gulp build" @@ -40,6 +41,7 @@ node { sh "docker-compose down --rmi 'all'" } stage ('Generating new dockers') { + sh "doker build -t vn-loopback:latest ./services/loopback/" sh "docker-compose up -d --build" } } diff --git a/gulpfile.js b/gulpfile.js index e0ad41234..5c8ded678 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -155,10 +155,12 @@ gulp.task('docker-compose', async () => { let services = await getServices(); for (let service of services) { - let dockerFile = `${__dirname}/services/${service.name}/Dockerfile`; + let dockerFile = `Dockerfile`; - // if (await fs.exists(`./services/${service.name}/Dockerfile`)) - // dockerFile = 'Dockerfile'; + let localDockerFile = `${__dirname}/services/${service.name}/Dockerfile`; + + if (await fs.exists(localDockerFile)) + dockerFile = localDockerFile; composeYml.services[service.name] = { environment: [ diff --git a/services/auth/Dockerfile b/services/auth/Dockerfile index 3a151e289..9d452364e 100644 --- a/services/auth/Dockerfile +++ b/services/auth/Dockerfile @@ -1,12 +1,7 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY auth /app -COPY loopback /loopback COPY nginx/static/webpack-assets.json /loopback/client/ WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] diff --git a/services/client/Dockerfile b/services/client/Dockerfile index 4f58e5ccf..d943bab55 100644 --- a/services/client/Dockerfile +++ b/services/client/Dockerfile @@ -1,12 +1,6 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY client /app -COPY loopback /loopback - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] diff --git a/services/item/Dockerfile b/services/item/Dockerfile index b87649c5f..c8f40351b 100644 --- a/services/item/Dockerfile +++ b/services/item/Dockerfile @@ -1,12 +1,6 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY item /app -COPY loopback /loopback - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] diff --git a/services/loopback/Dockerfile b/services/loopback/Dockerfile new file mode 100644 index 000000000..81fa3f78b --- /dev/null +++ b/services/loopback/Dockerfile @@ -0,0 +1,4 @@ +FROM node:8.9.4 + +COPY . /loopback +RUN npm -g install pm2 diff --git a/services/mailer/Dockerfile b/services/mailer/Dockerfile index 6ac52382e..393a55762 100644 --- a/services/mailer/Dockerfile +++ b/services/mailer/Dockerfile @@ -1,11 +1,6 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY mailer /app -COPY loopback /loopback - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] + diff --git a/services/order/Dockerfile b/services/order/Dockerfile deleted file mode 100644 index c4d8358db..000000000 --- a/services/order/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM node:8.9.4 - -COPY order /app -COPY loopback /loopback - -WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - -CMD ["pm2-docker", "./server/server.js"] - diff --git a/services/order/package.json b/services/order/package.json deleted file mode 100644 index f389ef8eb..000000000 --- a/services/order/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "vn-order", - "version": "1.0.0", - "main": "server/server.js", - "scripts": { - "lint": "eslint .", - "start": "node .", - "posttest": "npm run lint && nsp check" - }, - "repository": { - "type": "git", - "url": "https://git.verdnatura.es/salix" - }, - "license": "GPL-3.0", - "description": "vn-order" -} diff --git a/services/order/server/model-config.json b/services/order/server/model-config.json deleted file mode 100644 index 231c0b95f..000000000 --- a/services/order/server/model-config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - -} - - - diff --git a/services/order/server/server.js b/services/order/server/server.js deleted file mode 100644 index 030bbc1b4..000000000 --- a/services/order/server/server.js +++ /dev/null @@ -1,5 +0,0 @@ - -var vnLoopback = require('../../loopback/server/server.js'); - -var app = module.exports = vnLoopback.loopback(); -vnLoopback.boot(app, __dirname, module); diff --git a/services/print/Dockerfile b/services/print/Dockerfile index 9320bd0ac..79ec29c2f 100644 --- a/services/print/Dockerfile +++ b/services/print/Dockerfile @@ -1,11 +1,5 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY print /app -COPY loopback /loopback - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] diff --git a/services/production/Dockerfile b/services/production/Dockerfile index 81a08e017..c3c5f4472 100644 --- a/services/production/Dockerfile +++ b/services/production/Dockerfile @@ -1,11 +1,5 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY production /app -COPY loopback /loopback - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] diff --git a/services/route/Dockerfile b/services/route/Dockerfile index 71be84123..f2b9fb18b 100644 --- a/services/route/Dockerfile +++ b/services/route/Dockerfile @@ -1,11 +1,5 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY route /app -COPY loopback /loopback - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] diff --git a/services/salix/Dockerfile b/services/salix/Dockerfile index a7762e81e..cb1314ea6 100644 --- a/services/salix/Dockerfile +++ b/services/salix/Dockerfile @@ -1,12 +1,6 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY salix /app -COPY loopback /loopback COPY nginx/static/webpack-assets.json /loopback/client/ - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] diff --git a/services/ticket/Dockerfile b/services/ticket/Dockerfile index b91214f21..67552ee8c 100644 --- a/services/ticket/Dockerfile +++ b/services/ticket/Dockerfile @@ -1,12 +1,5 @@ -FROM node:8.9.4 +FROM vn-loopback:latest COPY ticket /app -COPY loopback /loopback - WORKDIR /app - -RUN npm install -RUN npm -g install pm2 - CMD ["pm2-docker", "./server/server.js"] -