#!/bin/bash # Check if the REPO_URL environment variable is set if [ -z "$GIT_REPO" ]; then echo "Error: REPO_URL environment variable is not set." exit 1 fi # Set the target directory TARGET_DIR="/home/app" # Check if the target directory already exists if [ ! -d "$TARGET_DIR" ]; then # If it doesn't exist, clone the repository git clone "$GIT_REPO" "$TARGET_DIR" else # If it already exists, update the repository cd "$TARGET_DIR" || exit 1 git pull origin master fi mkdir -p /var/run/supervisor # Run your application or desired command cmd="supervisord -c /etc/supervisor/supervisord.conf" $cmd