# rebuild-playwright-base.ps1 # ───────────────────────────────────────────────────────────────────────────── # Rebuild the Playwright base image for FinlyticNews. # # Run this script ONLY when you update the Playwright NuGet package version. # After running this, a normal `docker compose build` will be fast again. # # Usage: # .\rebuild-playwright-base.ps1 # .\rebuild-playwright-base.ps1 -Version 1.50.0 # when upgrading Playwright # ───────────────────────────────────────────────────────────────────────────── param( [string]$Version = "1.49.0" ) $ImageName = "finlytic-playwright-base:$Version" $Dockerfile = "FinlyticNews/Dockerfile.playwright-base" $Context = "FinlyticNews" Write-Host "" Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Cyan Write-Host " Building Playwright base image: $ImageName" -ForegroundColor Cyan Write-Host " This only needs to run when the Playwright version changes." -ForegroundColor DarkGray Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -ForegroundColor Cyan Write-Host "" docker build ` -f $Dockerfile ` --build-arg PLAYWRIGHT_VERSION=$Version ` -t $ImageName ` $Context if ($LASTEXITCODE -eq 0) { Write-Host "" Write-Host "✅ Base image '$ImageName' built and cached locally." -ForegroundColor Green Write-Host " You can now run 'docker compose build' as usual." -ForegroundColor Green Write-Host "" # Also tag as 'latest' for convenience docker tag $ImageName "finlytic-playwright-base:latest" Write-Host " Tagged as 'finlytic-playwright-base:latest' as well." -ForegroundColor DarkGray } else { Write-Host "" Write-Host "❌ Build failed. See errors above." -ForegroundColor Red exit 1 }