Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@danprince
Last active December 29, 2018 22:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save danprince/35443042bfc85b3952af829e5d18f811 to your computer and use it in GitHub Desktop.
Save danprince/35443042bfc85b3952af829e5d18f811 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