diff options
author | startxfr <clarue@startx.fr> | 2014-12-08 02:35:03 +0100 |
---|---|---|
committer | startxfr <clarue@startx.fr> | 2014-12-08 02:35:03 +0100 |
commit | ef2c1df934ee7720fd1ccacae042f3deb3b7628d (patch) | |
tree | 005eb1b5402f274f8643fa2d85ffa81da917a225 /Services/nodejs | |
parent | a7f649b8f1f56a999073550d1b91b5d8d1cd7d81 (diff) | |
download | phpmyadmin-ef2c1df934ee7720fd1ccacae042f3deb3b7628d.tar.gz phpmyadmin-ef2c1df934ee7720fd1ccacae042f3deb3b7628d.tar.bz2 phpmyadmin-ef2c1df934ee7720fd1ccacae042f3deb3b7628d.tar.xz phpmyadmin-ef2c1df934ee7720fd1ccacae042f3deb3b7628d.zip |
adding function and startup script for last services images : memcache, nodejs, ooconv and postresql
Diffstat (limited to 'Services/nodejs')
-rw-r--r-- | Services/nodejs/Dockerfile | 19 | ||||
-rw-r--r-- | Services/nodejs/README.md | 2 | ||||
-rw-r--r-- | Services/nodejs/app/app.js (renamed from Services/nodejs/app.js) | 0 | ||||
-rw-r--r-- | Services/nodejs/nodejs_run.sh | 2 | ||||
-rw-r--r-- | Services/nodejs/sx/nodejs.sh | 40 | ||||
-rw-r--r-- | Services/nodejs/sx/nodejs_run.sh | 7 |
6 files changed, 57 insertions, 13 deletions
diff --git a/Services/nodejs/Dockerfile b/Services/nodejs/Dockerfile index 0dac7de..872648a 100644 --- a/Services/nodejs/Dockerfile +++ b/Services/nodejs/Dockerfile @@ -1,18 +1,17 @@ FROM startx/fedora MAINTAINER Christophe 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 + && mkdir -p /var/nodejs /var/nodejs/app \ + && chmod ug+rx /var/nodejs/app +COPY sx/* /sx/ +COPY app/* /var/nodejs/app/ +RUN chmod ug+rx /sx/nodejs* EXPOSE 8000 +VOLUME ["/var/nodejs/app"] + +ENV MAIN_APP /var/nodejs/app/app.js -#CMD ["node", "/src/app.js"] -CMD ["/bin/nodejs_run.sh"] -ONBUILD CMD ["/bin/nodejs_run.sh"]
\ No newline at end of file +CMD ["/sx/nodejs_run.sh"]
\ No newline at end of file diff --git a/Services/nodejs/README.md b/Services/nodejs/README.md index e3961df..30c37c0 100644 --- a/Services/nodejs/README.md +++ b/Services/nodejs/README.md @@ -28,7 +28,7 @@ access to the running webserver access to the container itself - docker exec -it nodejs bash + docker exec -it nodejs /bin/bash ## Related Resources * [Sources files](https://github.com/startxfr/docker-images/tree/master/Services/nodejs) diff --git a/Services/nodejs/app.js b/Services/nodejs/app/app.js index 1dd5446..1dd5446 100644 --- a/Services/nodejs/app.js +++ b/Services/nodejs/app/app.js diff --git a/Services/nodejs/nodejs_run.sh b/Services/nodejs/nodejs_run.sh deleted file mode 100644 index b63a40c..0000000 --- a/Services/nodejs/nodejs_run.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -exec node /src/app.js
\ No newline at end of file diff --git a/Services/nodejs/sx/nodejs.sh b/Services/nodejs/sx/nodejs.sh new file mode 100644 index 0000000..fcf3ebb --- /dev/null +++ b/Services/nodejs/sx/nodejs.sh @@ -0,0 +1,40 @@ +#!/bin/bash +export TERM=dumb + +# Begin configuration before starting daemonized process +# and start generating host keys +function begin_config { + echo "=> Begin nodejs configuration for host $HOSTNAME" +} + +# End configuration process just before starting daemon +function end_config { + echo "=> End nodejs configuration ..." +} + +# Start the nodejs server in background. Used to perform config +# against the database structure such as user creation +function start_server { + echo "===> Starting nodejs server ..." + node $MAIN_APP & + sleep 4 +} + +# Stop the nodejs server running in background. +function stop_server { + echo "===> Stopping nodejs server ..." + killall node + sleep 4 +} + +# Start the nodejs server as a deamon and execute it inside +# the running shell +function start_daemon { + echo "=> Starting nodejs daemon ..." + exec node $MAIN_APP +} + + +if [[ "$0" == *"nodejs.sh" && ! $1 = "" ]];then + eval "$@"; +fi
\ No newline at end of file diff --git a/Services/nodejs/sx/nodejs_run.sh b/Services/nodejs/sx/nodejs_run.sh new file mode 100644 index 0000000..875dea2 --- /dev/null +++ b/Services/nodejs/sx/nodejs_run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +source /sx/nodejs.sh + +begin_config +end_config + +start_daemon
\ No newline at end of file |