diff options
author | eug-vs <eug-vs@keemail.me> | 2020-11-07 12:36:39 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-11-07 12:36:39 +0300 |
commit | a5feeaaca74d82a99bbb8063afee51cb9984f978 (patch) | |
tree | 51f0aed0350ede5932031b87a921baf37035704d | |
parent | 59bb116afd8d2be1cdd4ccf45a646d58eabab357 (diff) | |
download | which-api-a5feeaaca74d82a99bbb8063afee51cb9984f978.tar.gz |
feat: provide local MONGODB_URI in correct step
-rw-r--r-- | Dockerfile | 4 | ||||
-rw-r--r-- | docker-compose.yml | 7 |
2 files changed, 9 insertions, 2 deletions
@@ -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: |