This commit is contained in:
alban 2020-05-16 01:24:56 +02:00
commit aae4e3df8d
11 changed files with 1289 additions and 0 deletions

40
system/dev_run.sh Executable file
View file

@ -0,0 +1,40 @@
#!/bin/bash
msg(){
echo -e " \e[0;31m$@\e[0m";
}
docker(){
local D="$1"
msg "! $D Start reloading"
> /tmp/ci.work
sudo docker-compose down
sudo docker-compose build
sudo docker-compose up -d
sleep 3
rm -f /tmp/ci.work
msg "! $D Finished reloading"
}
reload(){
if [[ -f /tmp/ci.work ]] ; then
# msg "- $D Reload currently in progress. Skip."
return
fi
local D=$(date +%s-%N)
msg "= $D Change detected"
echo -n "$D">/tmp/ci
sleep 3
if [[ "$( cat /tmp/ci )" != "$D" ]] ; then
msg "x $D is now old. Exiting."
return
fi
docker "$D"
}
rm -f /tmp/ci*
while true; do
docker &
read something
done
#while inotifywait -e close_write,close_nowrite,create,delete .; do
# reload&
#done