Created
August 18, 2020 11:30
-
-
Save wibed/f22c5d8cec2e12c77d797eae453b59e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Description: | |
# sync with git remote and rebuild | |
# docker image if files have been modified | |
# VARS | |
_SCRIPTPATH="$(cd "$(dirname $0)"; pwd -P)" | |
_HEADPATH="${_SCRIPTPATH}/.git/refs/heads/master" | |
_MODDATE="$(stat -c %Y ${_HEADPATH})" | |
# main | |
main(){ | |
while true; do | |
sleep 5 | |
git pull | |
[ "$(stat -c %Y ${_HEADPATH})" -gt "${_MODDATE}" ] \ | |
&& _MODDATE=$(stat -c %Y ${_HEADPATH})" \ | |
&& docker-compose stop \ | |
&& docker-compose build \ | |
&& docker-compose up -d | |
done | |
} | |
main | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment