docker support

This commit is contained in:
Daniel Bulant 2021-07-20 11:53:03 +02:00
parent 304e21f377
commit db2d709a75
4 changed files with 17 additions and 1 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
node_modules

2
.gitignore vendored
View file

@ -1,6 +1,8 @@
config.json
package-lock.json
*.sqlite3
pnpm-lock.yaml
config-live.json
# Logs
logs

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
# syntax=docker/dockerfile:1
FROM node:14.15.3
ENV NODE_ENV=production
WORKDIR /app
COPY ["package.json", "./"]
RUN npm install --production
COPY . .
#RUN export DOCKER_HOST_IP=$(route -n | awk '/UG[ \t]/{print $2}')
ENV MONGO_HOST=mongodb://host.docker.internal:27017
CMD [ "node", "Main.js" ]

View file

@ -2,7 +2,7 @@
const { mongoServer } = require("../config.json");
const { MongoClient, Db } = require("mongodb");
const dbClient = new MongoClient(mongoServer, {
const dbClient = new MongoClient(process.env.MONGO_HOST || mongoServer, {
useUnifiedTopology: true
});