heartwood every commit a ring
591 B raw
#!/bin/sh
#
# For easy server deploys add this post-receive hook to your server in a bare
# repo somewhere like /srv/git/status/hooks/post-receive and make a git clone
# in /srv/docker/status. 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/status
    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