Skip to content

Commit

Permalink
Update script: do not always pull
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed Dec 7, 2023
1 parent 1c3d9ea commit 9eb03fd
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,48 @@ set -e
HERE=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$HERE"

# Default variable values
should_pull=false

# Function to display script usage
usage() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -h, --help Display this help message"
echo " -p, --pull Pulls all docker images"
}

# Function to handle options and arguments
handle_options() {
while [ $# -gt 0 ]; do
case $1 in
-h | --help)
usage
exit 0
;;
-p | --pull)
should_pull=true
;;
*)
echo "Invalid option: $1" >&2
usage
exit 1
;;
esac
shift
done
}

# Main script execution
handle_options "$@"

echo "Updating repo from Github"
git pull

echo "Updating docker images"
docker-compose pull
if [ "$should_pull" = true ]; then
echo "Updating docker images"
docker-compose pull
fi

echo "Launching updated services"
docker-compose up -d
Expand Down

0 comments on commit 9eb03fd

Please sign in to comment.