From 874ff182c6e4575d4eef2ea316be84f023a7ee1f Mon Sep 17 00:00:00 2001 From: Michiel Hazelhof Date: Tue, 12 Aug 2025 15:45:54 +0200 Subject: [PATCH] Properly detect previous version --- build.ps1 | 9 ++++++--- build.sh | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build.ps1 b/build.ps1 index 1d04b8f..37eede9 100644 --- a/build.ps1 +++ b/build.ps1 @@ -55,9 +55,12 @@ if ($args[0] -eq 'y') { } # stop and remove previous existing patch(ed) container -docker stop bitwarden-patch -docker rm bitwarden-patch -docker image rm bitwarden-patch +$oldinstances = docker container ps --all -f Name=bitwarden-patch --format '{{.ID}}' +foreach ($instance in $oldinstances) { + docker stop $instance + docker rm $instance + docker image rm $instance +} # start a new bitwarden instance so we can patch it $patchinstance = docker run -d --name bitwarden-patch ghcr.io/bitwarden/self-host:beta diff --git a/build.sh b/build.sh index 4125f8e..011f89d 100755 --- a/build.sh +++ b/build.sh @@ -58,9 +58,12 @@ else fi # stop and remove previous existing patch(ed) container -docker stop bitwarden-patch -docker rm bitwarden-patch -docker image rm bitwarden-patch +OLDINSTANCES=$(docker container ps --all -f Name=bitwarden-patch --format '{{.ID}}') +for INSTANCE in ${OLDINSTANCES[@]}; do + docker stop $INSTANCE + docker rm $INSTANCE + docker image rm $INSTANCE +done # start a new bitwarden instance so we can patch it PATCHINSTANCE=$(docker run -d --name bitwarden-patch ghcr.io/bitwarden/self-host:beta)