-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first commit, a first app with docker
- Loading branch information
Const
committed
Aug 12, 2017
0 parents
commit e9b87c9
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
.idea | ||
.vs |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM node:8-alpine | ||
|
||
WORKDIR /usr/app | ||
|
||
ADD . /usr/app | ||
RUN npm install --quiet | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["npm", "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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "docker-node-application", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"start": "node server/server.js" | ||
}, | ||
"dependencies": { | ||
"express": "^4.15.2" | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const express = require('express'); | ||
|
||
// Constants | ||
const PORT = 8080; | ||
const HOST = '0.0.0.0'; | ||
|
||
// App | ||
const app = express(); | ||
const host = process.env.HOSTNAME || '0.0.0.0'; | ||
app.get('/', (req, res) => { | ||
res.send(`<h1>Hello world!!</h1><p>${host}</p>`); | ||
}); | ||
|
||
app.listen(PORT, HOST); | ||
console.log(`Running on http://${HOST}:${PORT}`); |