From 352093a46888733cbd50ddb940f4f5b2f954a695 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 2 Sep 2025 17:21:28 +0200 Subject: [PATCH] feat: rebuild the local docker image when its base remote image is updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- scripts/docker-upgrade.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/docker-upgrade.sh b/scripts/docker-upgrade.sh index 5ff3550..54c170d 100755 --- a/scripts/docker-upgrade.sh +++ b/scripts/docker-upgrade.sh @@ -1,7 +1,8 @@ #!/usr/bin/env sh set -eu -DOCKER_IMAGE="freqtradeorg/freqtrade:stable" +LOCAL_DOCKER_IMAGE="reforcexy-freqtrade" +REMOTE_DOCKER_IMAGE="freqtradeorg/freqtrade:stable_freqairl" echo_timestamped() { command echo "$(date +"%Y-%m-%d %H:%M:%S") - $*" @@ -17,20 +18,21 @@ if [ ! -f "docker-compose.yml" ] && [ ! -f "docker-compose.yaml" ]; then exit 1 fi -echo_timestamped "Info: docker image pull for ${DOCKER_IMAGE}" -local_digest=$(command docker image inspect --format='{{.Id}}' "$DOCKER_IMAGE" 2>/dev/null || command echo "none") -if ! command docker image pull --quiet "$DOCKER_IMAGE"; then - echo_timestamped "Error: docker image pull failed for ${DOCKER_IMAGE}" +echo_timestamped "Info: docker image pull for ${REMOTE_DOCKER_IMAGE}" +local_digest=$(command docker image inspect --format='{{.Id}}' "$REMOTE_DOCKER_IMAGE" 2>/dev/null || command echo "none") +if ! command docker image pull --quiet "$REMOTE_DOCKER_IMAGE"; then + echo_timestamped "Error: docker image pull failed for ${REMOTE_DOCKER_IMAGE}" exit 1 fi -remote_digest=$(command docker image inspect --format='{{.Id}}' "$DOCKER_IMAGE" 2>/dev/null || command echo "none") +remote_digest=$(command docker image inspect --format='{{.Id}}' "$REMOTE_DOCKER_IMAGE" 2>/dev/null || command echo "none") if [ "$local_digest" != "$remote_digest" ]; then - echo_timestamped "Info: docker image ${DOCKER_IMAGE} was updated ($local_digest -> $remote_digest), wait for reload..." - echo_timestamped "Info: restarting docker image ${DOCKER_IMAGE}" + echo_timestamped "Info: docker image ${REMOTE_DOCKER_IMAGE} was updated ($local_digest -> $remote_digest), wait for reload..." + echo_timestamped "Info: restarting docker image ${REMOTE_DOCKER_IMAGE}" command docker compose --progress quiet down + command docker image rm "$LOCAL_DOCKER_IMAGE" command docker compose --progress quiet up -d - echo_timestamped "Info: restarted docker image ${DOCKER_IMAGE}" + echo_timestamped "Info: restarted docker image ${REMOTE_DOCKER_IMAGE}" else - echo_timestamped "Info: docker image ${DOCKER_IMAGE} is up to date" + echo_timestamped "Info: docker image ${REMOTE_DOCKER_IMAGE} is up to date" fi -- 2.43.0