This commit is contained in:
Dobromir Popov
2024-07-07 23:46:14 +03:00
parent e6165fd38f
commit c2507b43aa
2 changed files with 23 additions and 2 deletions

View File

@ -8,6 +8,7 @@ if [ "$UPDATE_CODE_FROM_GIT" = "true" ]; then
# Create a temporary directory for the new clone
rm -rf /tmp/clone
mkdir /tmp/clone
mkdir -p /app/logs
# Clone the repository
echo "\r\n\r\n Cloning repository..." | tee -a /app/logs/deploy.txt
@ -16,7 +17,24 @@ if [ "$UPDATE_CODE_FROM_GIT" = "true" ]; then
# Synchronize all files except package.json, package-lock.json, and the contents of /public/content
# rsync -av --filter='P /public/content/' --exclude 'package.json' --exclude 'package-lock.json' /tmp/clone/ /app/ || echo "Rsync failed: Issue synchronizing files"
echo "\r\n\r\n Synchronizing files..."
rsync -av --exclude '/public/content' --exclude 'package.json' --exclude 'package-lock.json' /tmp/clone/ /app/ || echo "Rsync failed: Issue synchronizing files" | tee -a /app/logs/deploy.txt
# rsync -av --exclude '/public/content' --exclude 'package.json' --exclude 'package-lock.json' /tmp/clone/ /app/ || echo "Rsync failed: Issue synchronizing files" | tee -a /app/logs/deploy.txt
# Clear previous log
echo "Starting sync process at $(date)" > /app/logs/deploy.txt
# Run rsync with verbose output and itemize-changes
rsync -av --itemize-changes --exclude 'public/content' --exclude 'package.json' --exclude 'package-lock.json' /tmp/clone/ /app/ >> /app/logs/deploy.txt 2>&1
# Check rsync exit status
if [ $? -ne 0 ]; then
echo "Rsync failed: Issue synchronizing files" | tee -a /app/logs/deploy.txt
cat /app/logs/deploy.txt # Display the log contents
else
echo "Rsync completed successfully" | tee -a /app/logs/deploy.txt
echo "Last few lines of rsync log:" | tee -a /app/logs/deploy.txt
tail -n 20 /app/logs/deploy.txt # Display the last 20 lines of the log
fi
echo "\r\n\r\n Checking for changes in package files..."