51 lines
1.3 KiB
Bash
51 lines
1.3 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
echo "========================================"
|
|
echo "Starting container setup..."
|
|
echo "========================================"
|
|
|
|
# Show current user and directory
|
|
echo "Current user: $(whoami)"
|
|
echo "Current directory: $(pwd)"
|
|
|
|
# Ensure directories exist with proper permissions
|
|
echo "Ensuring storage directories exist..."
|
|
mkdir -p storage/framework/{cache,sessions,views}
|
|
mkdir -p storage/logs
|
|
mkdir -p bootstrap/cache
|
|
|
|
# Set permissions
|
|
echo "Setting permissions..."
|
|
chmod -R 777 storage
|
|
chmod -R 777 bootstrap/cache
|
|
|
|
# Check if .env exists, create if not
|
|
if [ ! -f .env ]; then
|
|
echo "Creating .env file..."
|
|
if [ -f .env.example ]; then
|
|
cp .env.example .env
|
|
else
|
|
echo "APP_NAME=Laravel" > .env
|
|
echo "APP_ENV=production" >> .env
|
|
echo "APP_KEY=" >> .env
|
|
echo "APP_DEBUG=false" >> .env
|
|
echo "APP_URL=http://localhost" >> .env
|
|
fi
|
|
fi
|
|
|
|
# Run migrations if needed (optional)
|
|
# php artisan migrate --force
|
|
|
|
echo "========================================"
|
|
echo "Setup complete. Starting application..."
|
|
echo "========================================"
|
|
|
|
# Start the application
|
|
if [ "$MODE" = "dev" ]; then
|
|
echo "Starting PHP built-in server on port 8000..."
|
|
exec php artisan serve --host=0.0.0.0 --port=8000
|
|
else
|
|
echo "Starting PHP-FPM on port 9000..."
|
|
exec php-fpm
|
|
fi |