Files
kulakpos_web/entrypoint.sh

51 lines
1.3 KiB
Bash
Raw Normal View History

2026-03-16 10:20:15 +07:00
#!/bin/sh
set -e
echo "========================================"
echo "Starting container setup..."
echo "========================================"
2026-03-23 11:27:36 +07:00
# Show current user and directory
2026-03-16 10:20:15 +07:00
echo "Current user: $(whoami)"
echo "Current directory: $(pwd)"
2026-03-23 11:27:36 +07:00
# 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
2026-03-16 10:20:15 +07:00
# Set permissions
echo "Setting permissions..."
2026-03-23 11:27:36 +07:00
chmod -R 777 storage
chmod -R 777 bootstrap/cache
2026-03-16 10:20:15 +07:00
2026-03-23 11:27:36 +07:00
# Check if .env exists, create if not
2026-03-16 10:20:15 +07:00
if [ ! -f .env ]; then
2026-03-23 11:27:36 +07:00
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
2026-03-16 10:20:15 +07:00
fi
2026-03-23 11:27:36 +07:00
# Run migrations if needed (optional)
# php artisan migrate --force
2026-03-16 10:20:15 +07:00
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