Files
kulakpos_web/entrypoint2.sh

53 lines
1.8 KiB
Bash
Raw Normal View History

2026-03-31 01:17:24 +07:00
#!/bin/sh
set -e
echo "========================================"
echo "Starting KulakPOS Container Setup..."
echo "========================================"
# Tampilkan info dasar untuk debugging
echo "Current user: $(whoami)"
echo "Current directory: $(pwd)"
# 1. Fallback untuk kelengkapan env (agar container minimal bisa booting)
if [ ! -f .env ]; then
echo "⚠️ .env tidak ditemukan!"
if [ -f .env.example ]; then
echo "Menyalin dari .env.example..."
cp .env.example .env
fi
fi
# 2. Pastikan permission path krusial aman (berguna jika terkena Volume Mount di Docker Compose)
echo "Menyesuaikan izin (permissions) untuk storage & bootstrap/cache..."
mkdir -p storage/framework/cache/data storage/framework/sessions storage/framework/views storage/framework/testing storage/logs bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
# 3. Bersihkan cache instalasi/config lama
echo "Membersihkan cache Laravel..."
php artisan config:clear || true
# 4. Verifikasi Vite Build
if [ -f public/build/manifest.json ]; then
echo "✅ Vite manifest ditemukan."
else
echo "⚠️ Peringatan: Vite manifest public/build/manifest.json tidak ditemukan."
fi
# ========================================
# PENTING: Dihilangkan dari script ini:
# - composer install (Sudah dijamin ada pada Dockerfile, bukan di runtime)
# - chmod 777 (Diganti menjadi 775 dan chown www-data)
# - php -S (Kita standarkan aplikasi menggunakan php-fpm murni dari CMD Dockerfile)
# - Paksaan export APP_DEBUG
# ========================================
echo "========================================"
echo "Selesai. Menjalankan proses utama ($@)..."
echo "========================================"
# Serahkan eksekusi ke CMD milik Dockerfile (yaitu php-fpm)
exec "$@"