-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathafter-deploy-web-container.sh
More file actions
46 lines (35 loc) · 1.24 KB
/
after-deploy-web-container.sh
File metadata and controls
46 lines (35 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Get environment and base path from parameters
ENVIRONMENT=${1:-production}
BASE_PATH=${2:-/var/www} # Default to /var/www/html if not specified
echo " "
echo "//--- Running after-deploy-web-container.sh for $ENVIRONMENT at $BASE_PATH -----------------------------\\"
echo " "
# Navigate to the correct directory
cd $BASE_PATH
# Path to the changed files list
CHANGED_FILES_PATH="$BASE_PATH/changed_files.txt"
if [ -f "$CHANGED_FILES_PATH" ]; then
CHANGED_FILES=$(cat "$CHANGED_FILES_PATH")
echo "Last changed files:"
echo " ----------"
echo " $CHANGED_FILES"
echo " ----------"
else
echo "No changed files found."
CHANGED_FILES=""
fi
echo " "
echo "1 - Running Composer install..."
composer install --no-interaction --prefer-dist --optimize-autoloader || { echo "Composer install failed"; exit 1; }
echo "2 - Running database migrations..."
php artisan migrate --force || { echo "Database migrations failed"; exit 1; }
echo "3 - Running Caching views"
php artisan view:cache
echo "4 - Running Caching routes"
php artisan route:cache
echo "5 - Running Caching config"
php artisan config:cache
echo " "
echo "\--- Finished after-deploy-web-container.sh for $ENVIRONMENT _______________________________/"
echo " "