aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile4
-rw-r--r--docker-compose.yml7
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: