Last active
July 15, 2020 16:29
-
-
Save khatthaphone/dd0db6c94ab1b0601435899369589d4f to your computer and use it in GitHub Desktop.
Docker ແມ່ນອີ່ຫຍັງຫວະ? DevOps101 Ep1
This file contains 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
mkdir nodeapp | |
cd nodeapp | |
npm init | |
npm install --save express |
This file contains 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 node:12 | |
WORKDIR /app | |
COPY package.json . | |
RUN npm install | |
COPY . . | |
CMD ["npm", "run", "start"] |
This file contains 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
const express = require('express'); | |
const app = express(); | |
app.get('/', (req, res) => { | |
return res.send('<html><body>Sample made with ♥️</body></html>'); | |
}); | |
const port = process.env.port | 8080; | |
app.listen(port, () => { | |
console.log('listing on port:', port); | |
}); |
This file contains 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": "nodeapp", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"express": "^4.17.1" | |
}, | |
"devDependencies": {}, | |
"scripts": { | |
"start": "node index.js", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment