forked from DanWahlin/NodeExpressMongoDBDockerApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.dockerfile
More file actions
32 lines (20 loc) · 827 Bytes
/
node.dockerfile
File metadata and controls
32 lines (20 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Build: docker build -f node.dockerfile -t danwahlin/node .
# Option 1
# Start MongoDB and Node (link Node to MongoDB container with legacy linking)
# docker run -d --name my-mongodb mongo
# docker run -d -p 3000:3000 --link my-mongodb:mongodb --name nodeapp danwahlin/node
# Option 2: Create a custom bridge network and add containers into it
# docker network create --driver bridge isolated_network
# docker run -d --net=isolated_network --name mongodb mongo
# docker run -d --net=isolated_network --name nodeapp -p 3000:3000 danwahlin/node
# Seed the database with sample database
# Run: docker exec nodeapp node dbSeeder.js
FROM node:latest
LABEL author="Dan Wahlin"
ENV NODE_ENV=development
ENV PORT=3000
COPY . /var/www
WORKDIR /var/www
RUN npm install
EXPOSE $PORT
ENTRYPOINT ["npm", "start"]