Last active
December 29, 2018 22:52
-
-
Save danprince/35443042bfc85b3952af829e5d18f811 to your computer and use it in GitHub Desktop.
PM2 & Docker Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
*.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
services: | |
app: | |
build: . | |
ports: | |
- "3000:3000" | |
volumes: | |
- .:/code | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM keymetrics/pm2-docker-alpine:latest | |
ADD . /code | |
WORKDIR /code | |
RUN npm install | |
CMD ["npm", "start"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let express = require('express'); | |
let app = express(); | |
app.get('/', (req, res) => { | |
res.send('Hello world: 1'); | |
}); | |
app.listen(4000, () => { | |
console.log('Server started'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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