#!/bin/bash echo "๐Ÿ”ง Fixing file permissions and ownership for Docker development..." # Stop containers first echo "๐Ÿ›‘ Stopping containers..." docker-compose down # Fix ownership - change back to current user for development echo "๐Ÿ‘ค Fixing file ownership..." sudo chown -R $USER:$USER . # Set proper permissions for Laravel echo "๐Ÿ” Setting Laravel permissions..." chmod -R 755 . chmod -R 775 storage bootstrap/cache chmod 644 .env # Ensure public directory is readable chmod -R 755 public # Fix specific file permissions chmod 644 public/index.php chmod 644 artisan chmod +x artisan echo "๐Ÿ“‹ Current ownership:" ls -la public/index.php ls -la .env # Restart containers echo "๐Ÿš€ Starting containers..." docker-compose up -d # Wait for containers to be ready echo "โณ Waiting for containers..." sleep 10 # Test inside container echo "๐Ÿงช Testing file access in container..." docker exec ckb-app-dev ls -la /var/www/html/public/index.php # Test HTTP access echo "๐ŸŒ Testing HTTP access..." sleep 5 curl -I http://localhost:8000 echo "" echo "โœ… Permission fix completed!" echo "" echo "If still having issues, try:" echo "1. Check container logs: docker logs ckb-app-dev" echo "2. Test PHP directly: docker exec ckb-app-dev php /var/www/html/public/index.php" echo "3. Check nginx config: docker exec ckb-app-dev nginx -t"