From 61043d78665129fcc7860e3930854766e8717a82 Mon Sep 17 00:00:00 2001 From: juliokele <> Date: Sun, 20 Jul 2025 11:07:47 +0200 Subject: [PATCH] Fix the builds by removing redundant already removed and stopped old instance --- build.ps1 | 10 +++++----- build.sh | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.ps1 b/build.ps1 index f3d79fc..6576d81 100644 --- a/build.ps1 +++ b/build.ps1 @@ -39,7 +39,7 @@ Remove-Item "$pwd\src\bitBetter\cert.cert" -Force # gather all running instances $oldinstances = docker container ps --all -f Name=bitwarden --format '{{.ID}}' -# stop all running instances +# stop and remove all running instances foreach ($instance in $oldinstances) { docker stop $instance docker rm $instance @@ -58,10 +58,10 @@ else } } -# stop and remove previous existing patch(ed) container -docker stop bitwarden-patch -docker rm bitwarden-patch -docker image rm bitwarden-patch +# remove previous existing patch(ed) image +if (docker image ls -q bitwarden-patch) { + docker image rm bitwarden-patch +} # 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 468e22c..f0417b1 100755 --- a/build.sh +++ b/build.sh @@ -40,7 +40,7 @@ rm -f "$PWD/src/bitBetter/cert.cert" # gather all running instances OLDINSTANCES=$(docker container ps --all -f Name=bitwarden --format '{{.ID}}') -# stop all running instances +# stop and remove all running instances for INSTANCE in ${OLDINSTANCES[@]}; do docker stop $INSTANCE docker rm $INSTANCE @@ -58,10 +58,10 @@ else fi fi -# stop and remove previous existing patch(ed) container -docker stop bitwarden-patch -docker rm bitwarden-patch -docker image rm bitwarden-patch +# remove previous existing patch(ed) image +if [ "$(docker image ls -q bitwarden-patch)" ]; then + docker image rm bitwarden-patch +fi # start a new bitwarden instance so we can patch it PATCHINSTANCE=$(docker run -d --name bitwarden-patch ghcr.io/bitwarden/self-host:beta)