# ============================================================================== # CONFIGURATION # ============================================================================== $RootPath = "C:\Users\MohandL3G\Documents\Git\Docker-Compose" $ServicesToUpdate = @( "Cup", "Gitea", "Heimdall", "Immich", "Jellyfin", "Jellyseerr", "metube", "n8n", "Newt", "Nextcloud", "Nexterm", "NPM", "Portainer-CE", "Zerobyte" # "FutureApp" ) # ============================================================================== # EXECUTION LOGIC # ============================================================================== Write-Host "Starting Docker Stack Updates..." -ForegroundColor Cyan Write-Host "--------------------------------" -ForegroundColor Gray foreach ($Service in $ServicesToUpdate) { $ServicePath = Join-Path -Path $RootPath -ChildPath $Service if (Test-Path -Path $ServicePath) { Write-Host "`n[$Service] Checking..." -ForegroundColor Yellow Push-Location -Path $ServicePath try { # 1. PULL: This will show progress bars directly in your console. docker compose pull # 2. UP: This acts as the "Check". # If the image is new, it recreates the container. # If the image is old, it says "Up to date" and keeps running. docker compose up -d --remove-orphans --no-build Write-Host "[$Service] Done." -ForegroundColor Green } catch { Write-Host "[$Service] ERROR: Something went wrong." -ForegroundColor Red } finally { Pop-Location } } else { Write-Host "`n[$Service] WARNING: Folder not found at $ServicePath" -ForegroundColor Red } } # ============================================================================== # CLEANUP # ============================================================================== Write-Host "`n--------------------------------" -ForegroundColor Gray Write-Host "Cleaning up unused images..." -ForegroundColor Yellow docker image prune -f Write-Host "Cleanup Complete." -ForegroundColor Green Write-Host "All requested updates finished." -ForegroundColor Cyan