diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/.gitignore b/.gitignore index 11e51e6..5cd311e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ config.json package-lock.json *.sqlite3 +pnpm-lock.yaml +config-live.json # Logs logs diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b0631fa --- /dev/null +++ b/Dockerfile @@ -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" ] \ No newline at end of file diff --git a/database/mongo.js b/database/mongo.js index 9935cea..5b36a2b 100644 --- a/database/mongo.js +++ b/database/mongo.js @@ -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 });