Skip to content

Commit

Permalink
52
Browse files Browse the repository at this point in the history
  • Loading branch information
collinlucke committed Nov 29, 2024
1 parent ede384d commit 0173bd6
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions docker-push.ps1
Original file line number Diff line number Diff line change
@@ -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."
Expand Down

0 comments on commit 0173bd6

Please sign in to comment.