Skip to content

Commit

Permalink
Refactor entrypoint.sh script and add wait for DB to be ready
Browse files Browse the repository at this point in the history
  • Loading branch information
flemming-pr committed Jan 4, 2024
1 parent adbb874 commit ec06c7d
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions backend/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
#!/bin/bash

cd /var/www/html && mkdir -p storage/framework/{sessions,views,cache}
cd /var/www/html && php artisan storage:link
cd /var/www/html && php artisan optimize:clear
cd /var/www/html && php artisan config:cache
cd /var/www/html && php artisan route:cache
cd /var/www/html && php artisan view:cache
cd /var/www/html && php artisan event:cache
cd /var/www/html && php artisan migrate --force
ls -al

mkdir -p storage/framework/{sessions,views,cache}
php artisan storage:link
php artisan optimize:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan event:cache
# Wait until db is online
echo "Wait for DB to be ready"
while ! nc -z database 3306; do
sleep 0.5
echo "Wait 0.5 seconds"
done
echo "DB is ready"
sleep 1
php artisan migrate --force

exec "$@"

0 comments on commit ec06c7d

Please sign in to comment.