Skip to content

Instantly share code, notes, and snippets.

@khatthaphone
Last active July 15, 2020 16:29
Show Gist options
  • Save khatthaphone/dd0db6c94ab1b0601435899369589d4f to your computer and use it in GitHub Desktop.
Save khatthaphone/dd0db6c94ab1b0601435899369589d4f to your computer and use it in GitHub Desktop.
Docker ແມ່ນອີ່ຫຍັງຫວະ? DevOps101 Ep1
mkdir nodeapp
cd nodeapp
npm init
npm install --save express
FROM node:12
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]
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);
});
{
"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