browser-sec-lab/docker/php/entrypoint.sh
2026-04-17 00:24:11 +03:30

33 lines
1.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# توقف در صورت بروز خطای مهلک
set -e
echo "[+] Starting Initialization Process..."
# ۱. نصب وابستگی‌های PHP با نادیده گرفتن پکیج‌های Dev
echo "[+] Installing PHP dependencies via Composer..."
composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev
# ۲. پیکربندی محیط (Environment) لاراول
if [ ! -f .env ]; then
echo "[+] .env file not found. Creating from .env.example..."
cp .env.example .env
else
echo "[+] .env file already exists."
fi
# ۳. تولید کلید امنیتی لاراول (App Key)
echo "[+] Generating App Key..."
php artisan key:generate --no-interaction
# ۶. آماده‌سازی پایگاه داده
echo "[+] Running database migrations..."
# از سوییچ force استفاده می‌کنیم تا در محیط غیرتعاملی ارور ندهد
php artisan migrate --force
# ۷. اجرای سرویس اصلی
echo "[+] Starting PHP-FPM for Browser-Sec-Lab..."
exec php-fpm