From 822eff314a4bc9441be1c7e40034dad3a0e71722 Mon Sep 17 00:00:00 2001 From: nickpons666 Date: Wed, 22 Apr 2026 23:43:49 -0600 Subject: [PATCH] Fix: No cachear config al sincronizar variables de Docker --- docker/entrypoint.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index e85f915..6c2e08c 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -21,6 +21,15 @@ chown -R laravel:laravel /var/www/html/bootstrap/cache chmod -R 775 /var/www/html/storage chmod -R 775 /var/www/html/bootstrap/cache +echo "========================================" +echo " Limpiando cache (antes de sincronizar)..." +echo "========================================" +php /var/www/html/artisan view:clear 2>/dev/null || true +php /var/www/html/artisan config:clear 2>/dev/null || true +php /var/www/html/artisan cache:clear 2>/dev/null || true +php /var/www/html/artisan route:clear 2>/dev/null || true +php /var/www/html/artisan clear:compiled 2>/dev/null || true + echo "========================================" echo " Sincronizando variables de entorno..." echo "========================================" @@ -200,7 +209,7 @@ echo ">>> Contenido actual de .env:" grep -E "^(APP_NAME|APP_ENV|APP_DEBUG|APP_URL|DB_HOST|DB_PORT|DB_DATABASE|APP_KEY)=" "$ENV_FILE" 2>/dev/null || echo "No se pudo leer el .env" echo "" -# Limpiar cache +# Limpiar cache (importante despues de sincronizar) echo "========================================" echo " Limpiando cache..." echo "========================================" @@ -208,9 +217,13 @@ php /var/www/html/artisan view:clear 2>/dev/null || true php /var/www/html/artisan config:clear 2>/dev/null || true php /var/www/html/artisan cache:clear 2>/dev/null || true php /var/www/html/artisan route:clear 2>/dev/null || true +php /var/www/html/artisan clear:compiled 2>/dev/null || true -echo ">> Cacheando configuración..." -php /var/www/html/artisan config:cache 2>&1 || true +# NO hacer config:cache cuando el .env se sincroniza desde Docker +# Esto causa que PHP-FPM use valores en cache que no existen todavia +# En produccion con volumenes montados, Laravel lee el .env directamente +echo ">> Cache omitido - usando .env directo" +# php /var/www/html/artisan config:cache 2>&1 || true echo "========================================" echo " Estado de la aplicación"