Refactor Docker setup for Laravel 5.0 compatibility and optimize deployment process

- Updated Dockerfile configurations for various environments (alpine, basic, cloudrun, minimal, simple, test) to ensure compatibility with Laravel 5.0 and PHP 5.6.
- Added PHP compatibility documentation outlining mcrypt requirements and upgrade paths.
- Created cloudbuild.yaml for Google Cloud Build integration to streamline deployment to Cloud Run.
- Introduced docker-compose.local.yml for local development with MySQL and Redis services.
- Enhanced rebuild.sh script for easier local development and migration handling.
- Updated Laravel Blade views to correct asset paths.
- Added start-local.sh script for quick local setup and service management.
This commit is contained in:
Frank John Begornia
2025-08-11 23:14:31 +08:00
parent 70496dc874
commit 02c7f4e2aa
17 changed files with 1285 additions and 38 deletions

66
start-local.sh Executable file
View File

@@ -0,0 +1,66 @@
#!/bin/bash
# Quick start script for local development and testing before Cloud Run deployment
set -e
echo "🚀 Starting Merchbay Laravel Application Setup..."
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker is not running. Please start Docker and try again."
exit 1
fi
# Determine which docker compose command to use
if command -v docker-compose > /dev/null 2>&1; then
DOCKER_COMPOSE="docker-compose"
elif docker compose version > /dev/null 2>&1; then
DOCKER_COMPOSE="docker compose"
else
echo "❌ Neither 'docker-compose' nor 'docker compose' is available."
echo "Please install Docker Compose and try again."
exit 1
fi
echo " Using: $DOCKER_COMPOSE"
# Check if .env file exists
if [ ! -f .env ]; then
echo "📄 Creating .env file from .env.example..."
cp .env.example .env
echo "✅ .env file created. Please update it with your configuration."
fi
# Build and start services
echo "🔨 Building Docker images..."
$DOCKER_COMPOSE -f docker-compose.local.yml build
echo "🚀 Starting services..."
$DOCKER_COMPOSE -f docker-compose.local.yml up -d
echo "⏳ Waiting for services to be ready..."
sleep 30
# Run Laravel setup commands
echo "🔧 Setting up Laravel..."
$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan key:generate
#$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan migrate --force
$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan config:cache
$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan route:cache
$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan view:cache
echo "✅ Setup complete!"
echo ""
echo "🌐 Your application is now running at:"
echo " Application: http://localhost:8080"
echo " phpMyAdmin: http://localhost:8081"
echo ""
echo "📊 Check logs with:"
echo " $DOCKER_COMPOSE -f docker-compose.local.yml logs -f app"
echo ""
echo "🛑 Stop the application with:"
echo " $DOCKER_COMPOSE -f docker-compose.local.yml down"
echo ""
echo "🚀 When ready to deploy to Cloud Run, use:"
echo " gcloud builds submit --config=cloudbuild.yaml"