From: Jérôme Benoit Date: Tue, 2 Sep 2025 15:21:28 +0000 (+0200) Subject: feat: rebuild the local docker image when its base remote image is updated X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=352093a46888733cbd50ddb940f4f5b2f954a695;p=freqai-strategies.git feat: rebuild the local docker image when its base remote image is updated Signed-off-by: Jérôme Benoit --- 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