#!/bin/sh set -e SCRIPT_PATH=$(dirname $(readlink -f $0)) . $SCRIPT_PATH/post-receive-utils.sh title 'post-push: docker-pull: post receive hook' deploy REGISTRY_IMAGES=$(grep 'image:' $DEPLOY_DIR/current/docker-compose.yml | sed 's/image://g') IMAGE_LIST=$(echo "$REGISTRY_IMAGES" | cut -d";" -f1) for n in $IMAGE_LIST; do docker pull $n done cd $DEPLOY_DIR/current && docker-compose -f docker-compose.yml up -d --no-build if [ -n "$LOG_DIR" ]; then eval LOG_DIR="$LOG_DIR" if [ ! -d "$LOG_DIR" ]; then info "Creating Log Directory; $LOG_DIR" mkdir -p "$LOG_DIR" fi if [ -d "$LOG_DIR" ]; then info "Saving Logs To $LOG_DIR/$SERVICE_NAME.log" docker-compose -f docker-compose.yml logs -f >> "$LOG_DIR/$SERVICE_NAME.log" 2>&1 & fi fi post_startup