From a5feeaaca74d82a99bbb8063afee51cb9984f978 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 7 Nov 2020 12:36:39 +0300 Subject: feat: provide local MONGODB_URI in correct step --- Dockerfile | 4 ++-- docker-compose.yml | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index aeafcc9..892c159 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# Dockerfile to build which-api image + FROM node:12 WORKDIR /app @@ -8,8 +10,6 @@ RUN npm install COPY . . -ENV MONGODB_URI=mongodb://db:27017/which - EXPOSE 3030 CMD ["npm", "start"] diff --git a/docker-compose.yml b/docker-compose.yml index 1894901..f163ecd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,16 @@ +# Build and run which-api with database in container +# +# If you are getting "port already in use" error, +# try changing exposed ports, e.g 27017:27017 -> 27018:27017 + version: '3' services: app: container_name: which-api restart: always build: . + environment: + - MONGODB_URI=mongodb://db:27017/which ports: - '3030:3030' links: -- cgit v1.2.3