zeus 4 years ago
parent
commit
469c7abf25
  1. 11
      Dockerfile
  2. 4
      bootstrap-cron.sh
  3. 23
      startup.sh

11
Dockerfile

@ -7,6 +7,7 @@ LABEL MAINTAINERS="Guillaume Scheibel <guillaume.scheibel@gmail.com>, Damien DUP
# build/llo-base-images/asciidoctor-alpine/docker-asciidoctor # build/llo-base-images/asciidoctor-alpine/docker-asciidoctor
RUN apk add --no-cache \ RUN apk add --no-cache \
bash \ bash \
cron \
curl \ curl \
ca-certificates \ ca-certificates \
findutils \ findutils \
@ -38,6 +39,16 @@ RUN apk add --no-cache --virtual .pythonmakedepends \
seqdiag \ seqdiag \
&& apk del -r --no-cache .pythonmakedepends && apk del -r --no-cache .pythonmakedepends
# # Copy hello-cron file to the cron.d directory
COPY bootstrap-cron.sh /etc/cron.d/playground-cron
# Give execution rights on the cron job
RUN chmod 0744 /etc/cron.d/playground-cron
# Apply cron job
RUN crontab /etc/cron.d/playground-cron
RUN ln -s /usr/local/bin/node /usr/bin/node RUN ln -s /usr/local/bin/node /usr/bin/node
ADD supervisord.conf /etc/supervisor/supervisord.conf ADD supervisord.conf /etc/supervisor/supervisord.conf

4
bootstrap-cron.sh

@ -0,0 +1,4 @@
*/10 * * * * node /home/node/crond/playground-sync.sh >> /home/node/logs/cron.log 2>&1
# An empty line is required at the end of this file for a valid cron file.

23
startup.sh

@ -52,10 +52,15 @@ chmod +x /home/$USER/crond/playground.config.js
read -r -d '' VAR <<EOF read -r -d '' VAR <<EOF
#!/bin/bash #!/bin/bash
cd /home/$USER/project/tutor/$REPO if [ ! -d "$REPO" ] ; then
cd /home/$USER
git clone $GIT_TUTOR
else
cd /home/$USER/$REPO
git fetch origin master git fetch origin master
git reset --hard FETCH_HEAD git reset --hard FETCH_HEAD
git clean -df git clean -df
fi
@ -63,6 +68,22 @@ EOF
echo "$VAR" > /home/$USER/crond/playground-sync.sh echo "$VAR" > /home/$USER/crond/playground-sync.sh
chmod +x /home/$USER/crond/playground-sync.sh chmod +x /home/$USER/crond/playground-sync.sh
# ---------------------------
# install npm
# --------------------------
read -r -d '' VAR <<EOF
#!/bin/bash
cd /home/$USER/$REPO/swarmlab-app/src
npm install;
npm cache clean --force;
EOF
echo "$VAR" > /home/$USER/crond/playground-sync.sh
# ***************************************************** # *****************************************************
# ***************************************************** # *****************************************************
# ELSE # ELSE

Loading…
Cancel
Save