Fix: create .env before composer install (artisan needs it for post-scripts)

This commit is contained in:
root
2026-04-05 20:27:16 +02:00
parent 1632b568af
commit 086cce4617

View File

@@ -23,17 +23,7 @@ mkdir -p storage/logs
mkdir -p bootstrap/cache mkdir -p bootstrap/cache
# ----------------------------------------------- # -----------------------------------------------
# 1. Composer install # 1. .env file (must exist before composer/artisan)
# -----------------------------------------------
if [ ! -f vendor/autoload.php ]; then
echo "[*] Installing Composer dependencies..."
composer install --no-interaction --optimize-autoloader
else
echo "[✓] Composer dependencies already installed."
fi
# -----------------------------------------------
# 2. .env file
# ----------------------------------------------- # -----------------------------------------------
if [ ! -f .env ]; then if [ ! -f .env ]; then
echo "[*] Creating .env from .env.example..." echo "[*] Creating .env from .env.example..."
@@ -69,7 +59,7 @@ fi
echo "[✓] .env file ready." echo "[✓] .env file ready."
# ----------------------------------------------- # -----------------------------------------------
# 3. Application key # 2. Application key
# ----------------------------------------------- # -----------------------------------------------
if grep -q "^APP_KEY=$" .env; then if grep -q "^APP_KEY=$" .env; then
echo "[*] Generating application key..." echo "[*] Generating application key..."
@@ -86,6 +76,16 @@ else
echo "[✓] Application key already set." echo "[✓] Application key already set."
fi fi
# -----------------------------------------------
# 3. Composer install
# -----------------------------------------------
if [ ! -f vendor/autoload.php ]; then
echo "[*] Installing Composer dependencies..."
composer install --no-interaction --optimize-autoloader
else
echo "[✓] Composer dependencies already installed."
fi
# ----------------------------------------------- # -----------------------------------------------
# 4. NPM install & build assets # 4. NPM install & build assets
# ----------------------------------------------- # -----------------------------------------------