diff options
Diffstat (limited to 'Services/nodejs')
-rw-r--r-- | Services/nodejs/Dockerfile | 18 | ||||
-rw-r--r-- | Services/nodejs/README.md | 34 | ||||
-rw-r--r-- | Services/nodejs/app.js | 14 | ||||
-rw-r--r-- | Services/nodejs/nodejs_run.sh | 2 |
4 files changed, 68 insertions, 0 deletions
diff --git a/Services/nodejs/Dockerfile b/Services/nodejs/Dockerfile new file mode 100644 index 0000000..99d3023 --- /dev/null +++ b/Services/nodejs/Dockerfile @@ -0,0 +1,18 @@ +FROM startx/fedora +MAINTAINER Chistophe LARUE <dev@startx.fr> + +COPY nodejs_run.sh /bin/ +RUN yum -y install nodejs npm \ + && yum clean all \ + && mkdir -p /var/www/html \ + && mkdir -p /var/log/httpd \ + && chmod ug+rx /bin/nodejs_* + +WORKDIR /src +COPY app.js /src/app.js + +EXPOSE 8000 + +#CMD ["node", "/src/app.js"] +CMD ["/bin/nodejs_run.sh"] +ONBUILD CMD ["/bin/nodejs_run.sh"]
\ No newline at end of file diff --git a/Services/nodejs/README.md b/Services/nodejs/README.md new file mode 100644 index 0000000..f0b0326 --- /dev/null +++ b/Services/nodejs/README.md @@ -0,0 +1,34 @@ +# STARTX Services docker-images : Apache-PHP + +## Running from docker registry + + # docker run -d -p 8080:80 --name="test-www" -e VIRTUAL_HOST=www.project.startx.fr startx/sv-php + +## Running from local Dockerfile + +### Building docker image +Copy the sources to your docker host + + # mkdir startx-docker-images; + # git clone https://github.com/startxfr/docker-images.git startx-docker-images/ + # cd startx-docker-images/Services/php/ + +and build the container + + # docker build --rm -t <username>/www . + +### Running local image + + # docker run -d -p 8080:80 --name="test-www" -e VIRTUAL_HOST=www.project.startx.fr <username>/www + +## Accessing server + + # firefox http://localhost:8080 + +## Related Resources + +* [Sources files](https://github.com/startxfr/docker-images/tree/master/Services/php) +* [Github STARTX profile](https://github.com/startxfr/docker-images) +* [Docker registry for this container](https://registry.hub.docker.com/u/startx/sv-php/) +* [tutum php](https://registry.hub.docker.com/u/tutum/apache-php) + diff --git a/Services/nodejs/app.js b/Services/nodejs/app.js new file mode 100644 index 0000000..1dd5446 --- /dev/null +++ b/Services/nodejs/app.js @@ -0,0 +1,14 @@ +// 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"}); + response.end("Hello World\n"); +}); + +// Listen on port 8000, IP defaults to 127.0.0.1 +server.listen(8000); + +// Put a friendly message on the terminal +console.log("Server running at http://127.0.0.1:8000/");
\ No newline at end of file diff --git a/Services/nodejs/nodejs_run.sh b/Services/nodejs/nodejs_run.sh new file mode 100644 index 0000000..b63a40c --- /dev/null +++ b/Services/nodejs/nodejs_run.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec node /src/app.js
\ No newline at end of file |