Skip to content

Instantly share code, notes, and snippets.

@harryhan24
Forked from danprince/.gitignore
Created May 17, 2018 19:21
Show Gist options
  • Save harryhan24/7b2e744ced79118e6cdeac0fa0f836fc to your computer and use it in GitHub Desktop.
Save harryhan24/7b2e744ced79118e6cdeac0fa0f836fc to your computer and use it in GitHub Desktop.
PM2 & Docker Example
node_modules
*.log
version: 2
services:
app:
build: .
ports:
- "3000:3000"
volumes:
- .:/code
FROM keymetrics/pm2-docker-alpine:latest
ADD . /code
WORKDIR /code
RUN npm install
CMD ["npm", "start"]
let express = require('express');
let app = express();
app.get('/', (req, res) => {
res.send('Hello world: 1');
});
app.listen(4000, () => {
console.log('Server started');
});
{
"name": "pm2-docker",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "node test.js",
"start": "pm2-docker process.yml --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.14.0"
}
}
apps:
- script: 'index.js'
name: 'pm2-docker'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment