diff options
-rw-r--r-- | OS/Dockerfile | 2 | ||||
-rw-r--r-- | Services/apache/run.sh | 2 | ||||
-rw-r--r-- | Services/apache/sx-httpd.sh | 4 | ||||
-rw-r--r-- | Services/mariadb/run.sh | 8 | ||||
-rw-r--r-- | Services/memcache/run.sh | 6 | ||||
-rw-r--r-- | Services/mongo/run.sh | 6 | ||||
-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 | ||||
-rw-r--r-- | Services/php/run.sh | 2 |
11 files changed, 61 insertions, 20 deletions
diff --git a/OS/Dockerfile b/OS/Dockerfile index 4e393d1..45efeef 100644 --- a/OS/Dockerfile +++ b/OS/Dockerfile @@ -5,7 +5,7 @@ USER root # Install minimal packages RUN dnf -y install deltarpm pwgen tar python-dnf-plugins-extras-migrate && \ dnf-2 migrate && \ - dnf -y install psmisc procps coreutils findutils wget logrotate && \ + dnf -y install psmisc procps coreutils findutils wget logrotate tar zip && \ dnf clean all COPY *.sh /bin/ RUN chmod 775 /bin/sx-lib.sh /bin/run.sh diff --git a/Services/apache/run.sh b/Services/apache/run.sh index e06a7c5..ee10346 100644 --- a/Services/apache/run.sh +++ b/Services/apache/run.sh @@ -10,4 +10,4 @@ check_httpd_environment | tee -a $STARTUPLOG display_container_httpd_header | tee -a $STARTUPLOG begin_config | tee -a $STARTUPLOG end_config | tee -a $STARTUPLOG -start_daemon | tee -a $STARTUPLOG +start_daemon diff --git a/Services/apache/sx-httpd.sh b/Services/apache/sx-httpd.sh index a74e766..57a6e32 100644 --- a/Services/apache/sx-httpd.sh +++ b/Services/apache/sx-httpd.sh @@ -78,7 +78,7 @@ function stop_server { # Start the httpd server as a deamon and execute it inside # the running shell function start_daemon { - echo "=> Starting httpd daemon ..." - display_container_started + echo "=> Starting httpd daemon ..." | tee -a $STARTUPLOG + display_container_started | tee -a $STARTUPLOG exec /usr/sbin/apachectl -D FOREGROUND } diff --git a/Services/mariadb/run.sh b/Services/mariadb/run.sh index c5ce811..b8f8aed 100644 --- a/Services/mariadb/run.sh +++ b/Services/mariadb/run.sh @@ -154,7 +154,7 @@ function config_createdatabase { function config_importsql { if [[ -n "$LOADSQL_PATH" ]]; then echo "import sql data into " $MYSQL_DATABASE - if [[ ! -d $LOADSQL_PATH ]]; then + if [[ -d $LOADSQL_PATH ]]; then SCHEMALIST=$(find $LOADSQL_PATH/schema-*.sql -type f -printf "%f\n") for SCHEMAFILE in $SCHEMALIST; do echo "SET NAMES utf8;"|cat - $LOADSQL_PATH/$SCHEMAFILE > /tmp/out && mv /tmp/out $LOADSQL_PATH/$SCHEMAFILE @@ -184,8 +184,8 @@ function end_config { # Start the mariadb server as a deamon and execute it inside # the running shell function start_daemon { - echo "=> Starting mariadb daemon ..." - display_container_started + echo "=> Starting mariadb daemon ..." | tee -a $STARTUPLOG + display_container_started | tee -a $STARTUPLOG exec mysqld_safe } @@ -204,4 +204,4 @@ config_createdatabase | tee -a $STARTUPLOG config_importsql | tee -a $STARTUPLOG config_stopserver | tee -a $STARTUPLOG end_config | tee -a $STARTUPLOG -start_daemon | tee -a $STARTUPLOG +start_daemon diff --git a/Services/memcache/run.sh b/Services/memcache/run.sh index 405996e..1d6a60f 100644 --- a/Services/memcache/run.sh +++ b/Services/memcache/run.sh @@ -45,8 +45,8 @@ function end_config { # Start the memcache server as a deamon and execute it inside # the running shell function start_daemon { - echo "=> Starting memcache daemon ..." - display_container_started + echo "=> Starting memcache daemon ..." | tee -a $STARTUPLOG + display_container_started | tee -a $STARTUPLOG exec memcached -u daemon -v } @@ -59,4 +59,4 @@ check_environment | tee -a $STARTUPLOG display_container_memcache_header | tee -a $STARTUPLOG begin_config | tee -a $STARTUPLOG end_config | tee -a $STARTUPLOG -start_daemon | tee -a $STARTUPLOG +start_daemon diff --git a/Services/mongo/run.sh b/Services/mongo/run.sh index 3dd509d..195100e 100644 --- a/Services/mongo/run.sh +++ b/Services/mongo/run.sh @@ -72,9 +72,9 @@ function end_config { # Start the mongodb server as a deamon and execute it inside # the running shell function start_daemon { - echo "=> Starting mongodb daemon ..." + echo "=> Starting mongodb daemon ..." | tee -a $STARTUPLOG su mongodb - display_container_started + display_container_started | tee -a $STARTUPLOG exec /usr/bin/mongod --config $MONGOCONF --logappend --logpath $LOG_PATH \ --dbpath $DATA_PATH --journal --httpinterface \ --rest --master --storageEngine mmapv1 @@ -89,4 +89,4 @@ check_mongodb_environment | tee -a $STARTUPLOG display_container_mongodb_header | tee -a $STARTUPLOG begin_config | tee -a $STARTUPLOG end_config | tee -a $STARTUPLOG -start_daemon | tee -a $STARTUPLOG +start_daemon 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 diff --git a/Services/php/run.sh b/Services/php/run.sh index 4d4c580..e365b4e 100644 --- a/Services/php/run.sh +++ b/Services/php/run.sh @@ -11,4 +11,4 @@ display_container_httpd_header | tee -a $STARTUPLOG begin_config | tee -a $STARTUPLOG end_config | tee -a $STARTUPLOG display_container_started | tee -a $STARTUPLOG -start_daemon | tee -a $STARTUPLOG +start_daemon |