diff options
author | startxfr <clarue@startx.fr> | 2015-11-29 22:29:05 +0100 |
---|---|---|
committer | startxfr <clarue@startx.fr> | 2015-11-29 22:29:05 +0100 |
commit | a4930f0838f1224bdf4fa0885e858e7a865513ca (patch) | |
tree | a9d95b08985c439f2b812382e3b4a36cc990e87f /Services/nodejs | |
parent | eb3d88b10a0feb302a9fd1ec60a7a92caebb856c (diff) | |
download | phpmyadmin-a4930f0838f1224bdf4fa0885e858e7a865513ca.tar.gz phpmyadmin-a4930f0838f1224bdf4fa0885e858e7a865513ca.tar.bz2 phpmyadmin-a4930f0838f1224bdf4fa0885e858e7a865513ca.tar.xz phpmyadmin-a4930f0838f1224bdf4fa0885e858e7a865513ca.zip |
reshappe nodejs container
Diffstat (limited to 'Services/nodejs')
-rw-r--r-- | Services/nodejs/.gitignore | 1 | ||||
-rw-r--r-- | Services/nodejs/Dockerfile | 6 | ||||
-rw-r--r-- | Services/nodejs/package.json | 29 | ||||
-rw-r--r-- | Services/nodejs/run.sh | 15 |
4 files changed, 46 insertions, 5 deletions
diff --git a/Services/nodejs/.gitignore b/Services/nodejs/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/Services/nodejs/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/Services/nodejs/Dockerfile b/Services/nodejs/Dockerfile index 2113c64..43969a1 100644 --- a/Services/nodejs/Dockerfile +++ b/Services/nodejs/Dockerfile @@ -7,14 +7,16 @@ RUN dnf -y install nodejs npm python make gcc && \ ENV STARTUPLOG=/data/logs/nodejs/startup.log \ LOG_PATH=/data/logs/nodejs \ APP_PATH=/data/nodejs \ + TMP_APP_PATH=/tmp/nodejs \ APP_MAIN=/data/nodejs/app.js COPY *.sh /bin/ RUN chmod 775 /bin/run.sh && \ mkdir -p $APP_PATH && \ mkdir -p $LOG_PATH && \ touch $STARTUPLOG -COPY ./ $APP_PATH -RUN rm -f $APP_PATH/Dockerfile $APP_PATH/README.md $APP_PATH/run.sh $APP_PATH/docker-compose.yml +COPY *.json $TMP_APP_PATH/ +COPY *.js $TMP_APP_PATH/ +RUN cd $TMP_APP_PATH && npm install -production EXPOSE 8000 VOLUME [$APP_PATH,$LOG_PATH] diff --git a/Services/nodejs/package.json b/Services/nodejs/package.json new file mode 100644 index 0000000..78c3eed --- /dev/null +++ b/Services/nodejs/package.json @@ -0,0 +1,29 @@ +{ + "author": "startx", + "license": "BSD", + "bugs": { + "url": "https://github.com/startxfr/docker-images/issues" + }, + "private": true, + "dependencies": { + "express": "3.20.2", + "body-parser": "~1.12.3" + }, + "description": "docker template for nodejs app running on fedora linux)", + "version": "0.0.1", + "name": "startx-nodejs-server", + "keywords": [ + "nodejs", + "container", + "docker", + "startx" + ], + "repository": { + "type": "git", + "url": "https://github.com/startxfr/docker-images.git" + }, + "scripts": { + "test": "app.js" + }, + "main": "app.js" +} diff --git a/Services/nodejs/run.sh b/Services/nodejs/run.sh index f10bbd2..366446c 100644 --- a/Services/nodejs/run.sh +++ b/Services/nodejs/run.sh @@ -41,6 +41,15 @@ function display_container_nodejs_header { # and start generating host keys function begin_config { echo "=> BEGIN NODEJS CONFIGURATION" + if [[ -d $TMP_APP_PATH ]]; then + echo "COPY application from $TMP_APP_PATH into $APP_PATH" + FILE_LIST=$(find $TMP_APP_PATH -maxdepth 1 -mindepth 1 -printf "%f\n") + for FILE in $FILE_LIST; do + echo -n "adding $APP_PATH/$FILE" + mv -f $TMP_APP_PATH/$FILE $APP_PATH/ + echo " DONE" + done + fi } # End configuration process just before starting daemon @@ -51,8 +60,8 @@ function end_config { # Start the nodejs executable with application entrypoint # the running shell function start_daemon { - echo "=> Starting nodejs daemon ..." - display_container_started + echo "=> Starting nodejs daemon ..." | tee -a $STARTUPLOG + display_container_started | tee -a $STARTUPLOG exec node $APP_MAIN } @@ -64,4 +73,4 @@ check_nodejs_environment | tee -a $STARTUPLOG display_container_nodejs_header | tee -a $STARTUPLOG begin_config | tee -a $STARTUPLOG end_config | tee -a $STARTUPLOG -start_daemon | tee -a $STARTUPLOG +start_daemon |