Skip to content

Commit

Permalink
Add build to docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhanoya committed Sep 17, 2017
1 parent 97345ef commit eb3eb2d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Set the base image
FROM keymetrics/pm2:latest

# Define working directory
WORKDIR /

ADD . .

# Install app dependencies
RUN npm install --production

# Expose port
EXPOSE 3200

# Run app
CMD [ "pm2-docker", "start", "pm2.json" ]
2 changes: 1 addition & 1 deletion config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const config = {
hostname: process.env.HOSTNAME || 'localhost',
},
database: {
url: 'mongodb://localhost/express-production',
url: 'mongodb://mongo:27017/express-production',
},
},
};
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '2'
services:
mongo:
image: mongo:3.4
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null # --quiet
web:
build: .
ports:
- "8080:3200"
links:
- mongo
depends_on:
- mongo

11 changes: 11 additions & 0 deletions pm2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"apps": [
{
"name": "express-mvc-boilerplate",
"script": "app.js",
"env": {
"NODE_ENV": "production"
}
}
]
}

0 comments on commit eb3eb2d

Please sign in to comment.