# rebuild-playwright-base.ps1 # ───────────────────────────────────────────────────────────────────────────── # Build the shared Playwright base image (Chromium + Node + Playwright CLI). # # CONSUMERS — both reference this image as `FROM finlytic-playwright-base:`: # * FinlyticNews/Dockerfile # * FinlyticFundamentals/Dockerfile # # This image is NOT built by `docker compose build` (Compose does not resolve # FROM-references between services). It must exist locally BEFORE building # those two services, otherwise their build fails with "pull access denied". # # Equivalent Compose route (same image tag, declared in compose.yaml): # docker compose --profile build-base build finlytic-playwright-base # # Run this ONLY when the Microsoft.Playwright NuGet version changes # (see FinlyticCore/FinlyticCore.csproj) — otherwise the cached layer is reused. # # 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 " Consumers: FinlyticNews, FinlyticFundamentals" -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 }