From 0073a6b3db8720d9ac49330bc048b29688e39723 Mon Sep 17 00:00:00 2001 From: harish Date: Sat, 28 Nov 2020 12:08:38 +0530 Subject: [PATCH] Added docker file --- Dockerfile | 12 ++++++++++++ docker-compose.dev.yml | 25 +++++++++++++++++++++++++ docker-compose.yml | 25 +++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.dev.yml create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..17837e7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:12.18.1 +ENV NODE_ENV=development + +WORKDIR /app + +COPY ["package.json", "package-lock.json*", "./"] + +RUN npm install + +COPY . . + +CMD [ "node", "app.js" ] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..239ec65 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,25 @@ +version: '3.8' + +services: + notes: + build: + context: . + ports: + - 8000:8000 + environment: + - SERVER_PORT=8000 + - DATABASE_CONNECTIONSTRING=mongodb://localhost:27017/snake-game + volumes: + - ./:/code + command: node app.js + + mongo: + image: mongo:4.2.8 + ports: + - 27017:27017 + volumes: + - mongodb:/data/db + - mongodb_config:/data/configdb +volumes: + mongodb: + mongodb_config: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..59c1625 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.3' + +services: + notes: + build: + context: . + ports: + - 8000:8000 + environment: + - SERVER_PORT=8000 + - DATABASE_CONNECTIONSTRING=mongodb://localhost:27017/snake-game + volumes: + - ./:/code + command: node app.js + + mongo: + image: mongo:4.2.8 + ports: + - 27017:27017 + volumes: + - mongodb:/data/db + - mongodb_config:/data/configdb +volumes: + mongodb: + mongodb_config: