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 FROM node:current-slim
ENV NODE_ENV=production
WORKDIR /app-authentication WORKDIR /app-authentication
COPY ["package.json", "package-lock.json*", "./"] COPY ["package.json", "package-lock.json*", "./"]
RUN npm install --production RUN npm install --NODE_ENV
COPY . . COPY . .
CMD [ "node", "server.js" ] CMD [ "node", "server.js" ]

View file

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

View file

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