600 B
raw
#!/bin/sh
#
# For easy server deploys add this post-receive hook to your server in a bare
# repo somewhere like /srv/git/analytics/hooks/post-receive and make a git
# clone in /srv/docker/analytics. This script runs on push to rebuild and
# redeploy the docker container.
while read oldrev newrev ref; do
if [ "$ref" = "refs/heads/master" ]; then
unset GIT_DIR
START_TIME=`date +%s`
cd /srv/docker/analytics
git pull
docker-compose up --build --detach
docker system prune --force
END_TIME=`date +%s`
echo Total build time: `expr $END_TIME - $START_TIME`s
fi
done