fix docker
This commit is contained in:
@@ -5,42 +5,37 @@ echo "========================================"
|
||||
echo "Starting container setup..."
|
||||
echo "========================================"
|
||||
|
||||
# Show current user
|
||||
# Show current user and directory
|
||||
echo "Current user: $(whoami)"
|
||||
echo "Current directory: $(pwd)"
|
||||
|
||||
# Create directories one by one with error checking
|
||||
echo "Creating storage directories..."
|
||||
mkdir -p storage/framework/cache || { echo "Failed to create cache dir"; exit 1; }
|
||||
mkdir -p storage/framework/sessions || { echo "Failed to create sessions dir"; exit 1; }
|
||||
mkdir -p storage/framework/views || { echo "Failed to create views dir"; exit 1; }
|
||||
mkdir -p storage/logs || { echo "Failed to create logs dir"; exit 1; }
|
||||
mkdir -p bootstrap/cache || { echo "Failed to create bootstrap cache dir"; exit 1; }
|
||||
# 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 || { echo "Failed to set storage permissions"; exit 1; }
|
||||
chmod -R 777 bootstrap/cache || { echo "Failed to set bootstrap permissions"; exit 1; }
|
||||
chmod -R 777 storage
|
||||
chmod -R 777 bootstrap/cache
|
||||
|
||||
# Verify directories
|
||||
echo "Verifying directories..."
|
||||
ls -la storage/framework/
|
||||
ls -la bootstrap/
|
||||
|
||||
# Check if .env exists
|
||||
# Check if .env exists, create if not
|
||||
if [ ! -f .env ]; then
|
||||
echo "WARNING: .env file not found!"
|
||||
cp .env.example .env 2>/dev/null || echo "APP_ENV=production" > .env
|
||||
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
|
||||
|
||||
# Generate key
|
||||
echo "Generating application key..."
|
||||
php artisan key:generate --no-interaction --force || echo "Key generation failed"
|
||||
|
||||
# Clear cache
|
||||
echo "Clearing cache..."
|
||||
php artisan config:clear || true
|
||||
php artisan cache:clear || true
|
||||
# Run migrations if needed (optional)
|
||||
# php artisan migrate --force
|
||||
|
||||
echo "========================================"
|
||||
echo "Setup complete. Starting application..."
|
||||
|
||||
Reference in New Issue
Block a user