From 0173bd6c4dce81411a774660432bb8f6d1fa8058 Mon Sep 17 00:00:00 2001 From: "collin.lucke@gmail.com" Date: Fri, 29 Nov 2024 15:21:42 -0700 Subject: [PATCH] 52 --- docker-push.ps1 | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/docker-push.ps1 b/docker-push.ps1 index b426bd3..f43ab58 100644 --- a/docker-push.ps1 +++ b/docker-push.ps1 @@ -1,10 +1,35 @@ try { Write-Output "Starting Docker push process with elevated privileges..." - Start-Process -FilePath "powershell.exe" -ArgumentList "-Command docker-compose -f docker-compose.yml push" -Verb RunAs - Write-Output "Docker push process initiated..." - Start-Sleep -Seconds 30 # Give some time for the process to initiate - $pushStatus = Start-Process -FilePath "docker" -ArgumentList "push collinlucke/baphomet-server:latest" -Wait -PassThru - if ($pushStatus.ExitCode -eq 0) { + $processInfo = New-Object System.Diagnostics.ProcessStartInfo + $processInfo.FileName = "powershell.exe" + $processInfo.Arguments = "-Command docker-compose -f docker-compose.yml push" + $processInfo.Verb = "RunAs" + $processInfo.RedirectStandardOutput = $true + $processInfo.RedirectStandardError = $true + $processInfo.UseShellExecute = $false + $processInfo.CreateNoWindow = $true + + $process = New-Object System.Diagnostics.Process + $process.StartInfo = $processInfo + + # Start the process + $process.Start() | Out-Null + + # Capture output and errors + $standardOutput = $process.StandardOutput.ReadToEnd() + $standardError = $process.StandardError.ReadToEnd() + + # Wait for the process to exit + $process.WaitForExit() + $exitCode = $process.ExitCode + + # Output the results + Write-Output "Standard Output:" + Write-Output $standardOutput + Write-Output "Standard Error:" + Write-Output $standardError + + if ($exitCode -eq 0) { Write-Output "Docker push completed successfully." } else { Write-Output "Docker push encountered an error."