diff --git a/nodejs/Dockerfile b/nodejs/Dockerfile index f1eb264..2ee51ab 100644 --- a/nodejs/Dockerfile +++ b/nodejs/Dockerfile @@ -1,14 +1,14 @@ FROM ubuntu MAINTAINER Kimbro Staken - -RUN apt-get install -y software-properties-common python +RUN apt-get update +RUN apt-get --yes install software-properties-common python RUN add-apt-repository ppa:chris-lea/node.js RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list RUN apt-get update -RUN apt-get install -y nodejs +RUN apt-get --yes install nodejs #RUN apt-get install -y nodejs=0.6.12~dfsg1-1ubuntu1 RUN mkdir /var/www ADD app.js /var/www/app.js - +EXPOSE 8080 CMD ["/usr/bin/node", "/var/www/app.js"] diff --git a/nodejs10/Dockerfile b/nodejs10/Dockerfile new file mode 100644 index 0000000..72b2aa7 --- /dev/null +++ b/nodejs10/Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu +MAINTAINER Kimbro Staken + +RUN apt-get update +RUN apt-get --yes install software-properties-common python curl +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - +RUN apt-get update +RUN apt-get --yes install nodejs +RUN mkdir /var/www + +ADD app.js /var/www/app.js +EXPOSE 8080 +CMD ["/usr/bin/node", "/var/www/app.js"] diff --git a/nodejs10/app.js b/nodejs10/app.js new file mode 100644 index 0000000..6885180 --- /dev/null +++ b/nodejs10/app.js @@ -0,0 +1,16 @@ +// Load the http module to create an http server. +var http = require('http'); + +// Configure our HTTP server to respond with Hello World to all requests. +var server = http.createServer(function (request, response) { + response.writeHead(200, {"Content-Type": "text/plain"}); + text = "Running Node.js:" + process.versions.node + response.end(text); + +}); + +var port = process.env.PORT || 8080; +server.listen(port); + +// Put a friendly message on the terminal +console.log("Server running at http://127.0.0.1:" + port + "/");