fedi-feed-router/docker/dev/podman/container-start.sh

38 lines
1 KiB
Bash
Raw Normal View History

2025-08-02 03:07:27 +02:00
#!/bin/bash
# Copy development environment configuration
cp /var/www/html/docker/dev/podman/.env.dev /var/www/html/.env
# Install/update dependencies
echo "Installing PHP dependencies..."
composer install --no-interaction
echo "Installing Node dependencies..."
npm install
# Generate app key if not set or empty
if grep -q "APP_KEY=base64:YOUR_APP_KEY_HERE" /var/www/html/.env || ! grep -q "APP_KEY=base64:" /var/www/html/.env; then
echo "Generating application key..."
php artisan key:generate --force
fi
# Wait for database to be ready
echo "Waiting for database..."
while ! mysql -h db -u ffr_user -pffr_password --connect-timeout=2 -e "SELECT 1" >/dev/null 2>&1; do
echo "Database not ready, waiting..."
sleep 1
done
echo "Database connection established!"
# Run migrations and seeders
php artisan migrate --force
php artisan db:seed --force
# Start Laravel development server in background
php artisan serve --host=0.0.0.0 --port=8000 &
# Start Vite development server
npm run dev -- --host 0.0.0.0
# Wait for background processes
wait