Docker added

This commit is contained in:
NyxiumYuuki 2021-05-28 08:01:50 +02:00
parent 8cf6520224
commit 157c0e13a7
3 changed files with 39 additions and 68 deletions

View file

@ -1,8 +1,6 @@
# syntax=docker/dockerfile:1
FROM node:current-slim
ENV NODE_ENV=production
WORKDIR /app-authentication
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install --production
RUN npm install --NODE_ENV
COPY . .
CMD [ "node", "server.js" ]

View file

@ -6,7 +6,9 @@ let db;
module.exports = {
connectToServer: function( callback ) {
MongoClient.connect( uri, { useNewUrlParser: true, useUnifiedTopology: true }, function( err, client ) {
console.log(client.isConnected());
db = client.db(config.mongodbDatabase);
return callback( err );
});
},

View file

@ -1,82 +1,53 @@
version: '3.7'
networks:
net:
version: '3.8'
services:
frontend:
image: frontend
environment:
SERVICE_ADRESS: frontend
SERVICE_PORT: 4200
ports:
- 4200:4200
networks:
- net
service-authentication:
image: service-authentication
environment:
SERVICE_ADRESS: service-authentication
SERVICE_PORT: 3000
ports:
- 3000:3000
networks:
- net
service-message:
image: service-message
environment:
SERVICE_ADRESS: service-message
SERVICE_PORT: 3000
build: backend/service-authentication
command: node server.js
volumes:
- backend/service-authentication
- backend/service-authentication/node_modules
ports:
- 3001:3000
networks:
- net
service-notification:
image: service-notification
depends_on:
- mongodb-authentication
environment:
SERVICE_ADRESS: service-notification
SERVICE_PORT: 3000
ports:
- 3002:3000
networks:
- net
NODE_ENV: development
service-privateroom:
image: service-privateroom
environment:
SERVICE_ADRESS: service-privateroom
SERVICE_PORT: 3000
service-message:
build: backend/service-message
command: node server.js
volumes:
- backend/service-message
- backend/service-message/node_modules
ports:
- 3003:3000
networks:
- net
- 3000:3000
depends_on:
- mongodb-message
environment:
NODE_ENV: development
mongodb-authentication:
image: mongo
networks:
- net
container_name: mongodb-authentication
environment:
- PUID=1001
- PGID=1001
volumes:
- ./backend/service-authentication/database:/data/db
ports:
- 27017:27017
restart: unless-stopped
mongodb-message:
image: mongo
networks:
- net
container_name: mongodb-message
environment:
- PUID=1000
- PGID=1000
volumes:
- ./backend/service-message/database:/data/db
ports:
- 27020:27017
mongodb-notification:
image: mongo
networks:
- net
ports:
- 27021:27017
mongodb-privateroom:
image: mongo
networks:
- net
ports:
- 27022:27017
restart: unless-stopped