Last active
August 29, 2015 13:56
-
-
Save lvidarte/9254883 to your computer and use it in GitHub Desktop.
Node.js Hello World app on Ubuntu using docker
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
var express = require('express'); | |
var port = 8080; | |
var app = express(); | |
app.get('/', function (req, res) { | |
res.send('Hello World\n'); | |
}); | |
app.listen(port) | |
console.log('Running on http://localhost:' + 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
FROM ubuntu:13.10 | |
RUN apt-get update | |
RUN apt-get install -y nodejs npm | |
ADD . /src | |
RUN cd /src; npm install | |
EXPOSE 8080 | |
CMD ["nodejs", "/src/app.js"] |
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": "ubuntu-node-hello", | |
"private": true, | |
"version": "0.0.1", | |
"description": "Node.js Hello World app on Ubuntu using docker", | |
"author": "Leonardo Vidarte <lvidarte@gmail.com>", | |
"dependencies": { | |
"express": "3.2.4" | |
} | |
} |
Download my image created by the above code
docker pull lvidarte/ubuntu-node-hello
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then build the image
And run the image
Check the app on http://localhost:49160