30 lines
694 B
Bash
Executable File
30 lines
694 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Check if the REPO_URL environment variable is set
|
|
if [ -z "$GIT_REPO" ]; then
|
|
echo "Error: GIT_REPO 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
|
|
|
|
cd "$TARGET_DIR" || exit 1
|
|
pip install -r requirements.txt
|
|
|
|
mkdir -p /var/run/supervisor
|
|
|
|
# Run your application or desired command
|
|
cmd="supervisord -c /etc/supervisor/supervisord.conf"
|
|
$cmd
|