Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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