summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Services/nodejs/Dockerfile15
-rw-r--r--Services/nodejs/run.sh34
-rw-r--r--circle.yml4
3 files changed, 20 insertions, 33 deletions
diff --git a/Services/nodejs/Dockerfile b/Services/nodejs/Dockerfile
index 74fec14..2f9e8f5 100644
--- a/Services/nodejs/Dockerfile
+++ b/Services/nodejs/Dockerfile
@@ -6,18 +6,19 @@ RUN dnf -y install nodejs npm python make gcc && \
dnf clean all
ENV STARTUPLOG=/logs/startup.log \
LOG_PATH=/logs \
- APP_PATH=/data \
- TMP_APP_PATH=/tmp/nodejs \
- APP_MAIN=/data/app.js
+ DATA_PATH=/data \
+ APP_PATH=/app \
+ APP_MAIN=/app/app.js
COPY *.sh /bin/
RUN chmod 775 /bin/run.sh && \
mkdir -p $APP_PATH && \
+ mkdir -p $DATA_PATH && \
mkdir -p $LOG_PATH && \
touch $STARTUPLOG
-COPY *.json $TMP_APP_PATH/
-COPY *.js $TMP_APP_PATH/
-RUN cd $TMP_APP_PATH && npm install -production
+COPY *.json $APP_PATH/
+COPY *.js $APP_PATH/
+RUN cd $APP_PATH && npm install -production
EXPOSE 8000
-VOLUME [$APP_PATH,$LOG_PATH]
+VOLUME [$DATA_PATH,$LOG_PATH]
CMD ["/bin/run.sh"] \ No newline at end of file
diff --git a/Services/nodejs/run.sh b/Services/nodejs/run.sh
index 870958a..dcf7bac 100644
--- a/Services/nodejs/run.sh
+++ b/Services/nodejs/run.sh
@@ -1,13 +1,16 @@
#!/bin/bash
source /bin/sx-lib.sh
-
function check_nodejs_environment {
check_environment
if [ ! -v APP_PATH ]; then
- APP_PATH="/data"
+ APP_PATH="/app"
export APP_PATH
fi
+ if [ ! -v DATA_PATH ]; then
+ DATA_PATH="/data"
+ export DATA_PATH
+ fi
if [ ! -v LOG_PATH ]; then
LOG_PATH="/logs"
export LOG_PATH
@@ -31,34 +34,15 @@ function display_container_nodejs_header {
if [ -v APP_PATH ]; then
echo "| App path : $APP_PATH"
fi
+ if [ -v DATA_PATH ]; then
+ echo "| Data path : $DATA_PATH"
+ fi
if [ -v LOG_PATH ]; then
echo "| Log path : $LOG_PATH"
fi
echo "+====================================================="
}
-# Begin configuration before starting daemonized process
-# and start generating host keys
-function begin_config {
- echo "=> BEGIN NODEJS CONFIGURATION"
- if [[ -d $TMP_APP_PATH ]]; then
- if [ "$(ls -A $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"
- cp -r $TMP_APP_PATH/$FILE $APP_PATH/
- echo " DONE"
- done
- fi
- fi
-}
-
-# End configuration process just before starting daemon
-function end_config {
- echo "=> END NODEJS CONFIGURATION"
-}
-
function stop_nodejs_handler {
killall node
echo "+=====================================================" | tee -a $STARTUPLOG
@@ -79,6 +63,4 @@ function start_service_nodejs {
check_nodejs_environment | tee -a $STARTUPLOG
display_container_nodejs_header | tee -a $STARTUPLOG
-begin_config | tee -a $STARTUPLOG
-end_config | tee -a $STARTUPLOG
start_service_nodejs
diff --git a/circle.yml b/circle.yml
new file mode 100644
index 0000000..c4500fb
--- /dev/null
+++ b/circle.yml
@@ -0,0 +1,4 @@
+checkout:
+ post:
+ - git submodule sync
+ - git submodule update --init