first commit

This commit is contained in:
Giuseppe Naponiello
2026-06-14 19:01:02 +02:00
commit 36bcc9a842
98 changed files with 26936 additions and 0 deletions

27
backend/entrypoint.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/bin/sh
# Immagine php:8.4-fpm-alpine: niente bash, solo /bin/sh (busybox ash).
# set -eu basta (nessuna pipe nello script → pipefail non serve e non è POSIX).
set -eu
echo "Waiting for database connection..."
# Riprova la connessione finché MySQL non risponde (max ~60s)
ATTEMPTS=0
until php artisan db:show >/dev/null 2>&1; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -ge 30 ]; then
echo "MySQL not reachable after 60s, exiting." >&2
exit 1
fi
sleep 2
done
echo "MySQL ready. Executing pending migrations (idempotent)..."
# --force: niente prompt interattivo
# migrate normale: applica SOLO le migration non ancora eseguite, non tocca i dati esistenti
php artisan migrate --force
# Avvia il processo principale passato come CMD (php-fpm, artisan serve, ecc.)
echo "Starting application..."
exec "$@"