fix: jalankan composer install sebelum tunggu MySQL — elak stuck di wait loop
This commit is contained in:
@@ -17,7 +17,25 @@ echo "║ eCert MBIP — Container Start ║"
|
||||
echo "╚══════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
# ── 1. Tunggu MySQL bersedia ──────────────────────────────────────────────────
|
||||
# ── 1. Pasang Composer dependencies (sebelum tunggu MySQL) ───────────────────
|
||||
if [ ! -d /var/www/vendor ]; then
|
||||
echo "📦 Memasang Composer dependencies..."
|
||||
if [ "${APP_ENV}" = "production" ]; then
|
||||
composer install \
|
||||
--no-interaction \
|
||||
--no-dev \
|
||||
--no-progress \
|
||||
--prefer-dist \
|
||||
--optimize-autoloader
|
||||
else
|
||||
composer install \
|
||||
--no-interaction \
|
||||
--no-progress \
|
||||
--prefer-dist
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── 2. Tunggu MySQL bersedia ──────────────────────────────────────────────────
|
||||
DB_HOST="${DB_HOST:-host.docker.internal}"
|
||||
DB_PORT="${DB_PORT:-3306}"
|
||||
DB_DATABASE="${DB_DATABASE:-ecert_mbip}"
|
||||
@@ -44,24 +62,6 @@ done
|
||||
echo ""
|
||||
echo "✓ MySQL bersedia."
|
||||
|
||||
# ── 2. Pasang Composer dependencies ──────────────────────────────────────────
|
||||
if [ ! -d /var/www/vendor ]; then
|
||||
echo "📦 Memasang Composer dependencies..."
|
||||
if [ "${APP_ENV}" = "production" ]; then
|
||||
composer install \
|
||||
--no-interaction \
|
||||
--no-dev \
|
||||
--no-progress \
|
||||
--prefer-dist \
|
||||
--optimize-autoloader
|
||||
else
|
||||
composer install \
|
||||
--no-interaction \
|
||||
--no-progress \
|
||||
--prefer-dist
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── 2b. Fix storage permissions (penting untuk named volume di production) ────
|
||||
chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache 2>/dev/null || true
|
||||
chmod -R 775 /var/www/storage /var/www/bootstrap/cache 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user