Skip to content

Commit 9f9af0f

Browse files
Add sample to be used in container template docs
1 parent dc99812 commit 9f9af0f

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

app/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
npm-debug.log

app/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node:8
2+
3+
WORKDIR /usr/src/app
4+
5+
COPY package*.json ./
6+
RUN npm ci --only=production
7+
8+
COPY . .
9+
10+
EXPOSE 8080
11+
CMD [ "npm", "start" ]

app/package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "my_app",
3+
"version": "1.0.0",
4+
"description": "Sample used for container templates",
5+
"author": "Shashank Barsin",
6+
"main": "server.js",
7+
"scripts": {
8+
"start": "node server.js"
9+
},
10+
"dependencies": {
11+
"express": "^4.16.4"
12+
}
13+
}

app/server.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
const express = require('express');
4+
5+
const PORT = 8080;
6+
const HOST = '0.0.0.0';
7+
8+
const app = express();
9+
app.get('/', (req, res) => {
10+
res.send('Hello world\n');
11+
});
12+
13+
app.listen(PORT, HOST);
14+
console.log(`Running on http://${HOST}:${PORT}`);

0 commit comments

Comments
 (0)