#!/bin/sh # Initialisation au démarrage du service principal uniquement (php-fpm). # Une commande ponctuelle (docker compose run app php artisan …) est exécutée directement. cd /var/www/html || exit 1 if [ "$1" = "php-fpm" ]; then # Publie l'add-in compilé dans le volume partagé avec Nginx if [ -d /srv/addin ]; then rm -rf /srv/addin/* && cp -r /opt/addin-dist/. /srv/addin/ fi # Un échec de migration ne doit pas faire boucler le conteneur : on journalise et on démarre. php artisan migrate --force || echo "[entrypoint] ATTENTION : migrations en échec, voir les logs ci-dessus" >&2 php artisan config:cache || true php artisan route:cache || true php artisan view:cache || true # Les commandes ci-dessus tournent en root : on rend storage et le cache à www-data chown -R www-data:www-data storage bootstrap/cache fi exec "$@"