fix docker
This commit is contained in:
@@ -9,32 +9,65 @@ echo "========================================"
|
|||||||
echo "Current user: $(whoami)"
|
echo "Current user: $(whoami)"
|
||||||
echo "Current directory: $(pwd)"
|
echo "Current directory: $(pwd)"
|
||||||
|
|
||||||
# Ensure directories exist with proper permissions
|
# Create ALL required Laravel directories
|
||||||
echo "Ensuring storage directories exist..."
|
echo "Creating storage directories..."
|
||||||
mkdir -p storage/framework/{cache,sessions,views}
|
mkdir -p storage/framework/cache
|
||||||
|
mkdir -p storage/framework/sessions
|
||||||
|
mkdir -p storage/framework/views
|
||||||
|
mkdir -p storage/framework/testing
|
||||||
mkdir -p storage/logs
|
mkdir -p storage/logs
|
||||||
mkdir -p bootstrap/cache
|
mkdir -p bootstrap/cache
|
||||||
|
|
||||||
|
# Also create the view cache directory (sometimes needed)
|
||||||
|
mkdir -p storage/framework/views
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
echo "Setting permissions..."
|
echo "Setting permissions..."
|
||||||
chmod -R 777 storage
|
chmod -R 777 storage
|
||||||
chmod -R 777 bootstrap/cache
|
chmod -R 777 bootstrap/cache
|
||||||
|
|
||||||
|
# Create cache file if it doesn't exist
|
||||||
|
touch storage/framework/cache/.gitignore
|
||||||
|
touch storage/framework/sessions/.gitignore
|
||||||
|
touch storage/framework/views/.gitignore
|
||||||
|
touch storage/logs/.gitignore
|
||||||
|
|
||||||
|
# Verify directories exist
|
||||||
|
echo "Verifying directories..."
|
||||||
|
ls -la storage/framework/
|
||||||
|
ls -la bootstrap/
|
||||||
|
|
||||||
# Check if .env exists, create if not
|
# Check if .env exists, create if not
|
||||||
if [ ! -f .env ]; then
|
if [ ! -f .env ]; then
|
||||||
echo "Creating .env file..."
|
echo "Creating .env file..."
|
||||||
if [ -f .env.example ]; then
|
if [ -f .env.example ]; then
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
else
|
else
|
||||||
echo "APP_NAME=Laravel" > .env
|
cat > .env << 'EOF'
|
||||||
echo "APP_ENV=production" >> .env
|
APP_NAME=Laravel
|
||||||
echo "APP_KEY=" >> .env
|
APP_ENV=local
|
||||||
echo "APP_DEBUG=false" >> .env
|
APP_KEY=
|
||||||
echo "APP_URL=http://localhost" >> .env
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run migrations if needed (optional)
|
# Generate key if not present
|
||||||
|
if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then
|
||||||
|
echo "Generating application key..."
|
||||||
|
php artisan key:generate --no-interaction --force || echo "Key generation failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clear all caches to ensure fresh state
|
||||||
|
echo "Clearing caches..."
|
||||||
|
php artisan config:clear || true
|
||||||
|
php artisan cache:clear || true
|
||||||
|
php artisan view:clear || true
|
||||||
|
php artisan route:clear || true
|
||||||
|
|
||||||
|
# Optional: Run migrations if needed
|
||||||
# php artisan migrate --force
|
# php artisan migrate --force
|
||||||
|
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
|
|||||||
Reference in New Issue
Block a user