From bf518660c70445c1a2e66de41583ee4f6c7bc4ab Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Fri, 14 Nov 2025 17:00:20 -0800 Subject: [PATCH] Add BTCPAY_UPDATE_CLEAN environment option This commit provides a less-intrusive pruning of all images after running an update. Ideally, there would be a better prune filter but that appears to require more granular tracking of images; including btcpayserver/docker-compose-generator (which only pulls from latest). This option should suffice for the time being. --- README.md | 1 + btcpay-setup.sh | 3 +++ btcpay-update.sh | 2 +- helpers.sh | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e0d1573..fca70e3 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ Check out this video if you're interested in learning more about setting up [BTC * `BTCPAY_ENABLE_SSH`: Optional, gives BTCPay Server SSH access to the host by allowing it to edit authorized_keys of the host, it can be used for managing the authorized_keys or updating BTCPay Server directly through the website. (Default: false) * `BTCPAYGEN_DOCKER_IMAGE`: Optional, Specify which generator image to use if you have customized the C# generator. Set to `btcpayserver/docker-compose-generator:local` to build the generator locally at runtime. * `BTCPAY_IMAGE`: Optional, Specify which btcpayserver image to use if you have a customized btcpayserver. +* `BTCPAY_UPDATE_CLEAN`: Clean (prune) all old BTCPayServer images after an update. WARNING: also removes all non-BTCPayServer images! (default: true) * `BTCPAYGEN_EXCLUDE_FRAGMENTS`: Semicolon-separated list of fragments you want to forcefully exclude (eg. `litecoin-clightning`) * `TOR_RELAY_NICKNAME`: If tor relay is activated with opt-add-tor-relay, the relay nickname * `TOR_RELAY_EMAIL`: If tor relay is activated with opt-add-tor-relay, the email for Tor to contact you regarding your relay diff --git a/btcpay-setup.sh b/btcpay-setup.sh index 1aa65f8..96c5db1 100755 --- a/btcpay-setup.sh +++ b/btcpay-setup.sh @@ -98,6 +98,7 @@ Environment variables: BTCPAY_ENABLE_SSH: Optional, gives BTCPay Server SSH access to the host by allowing it to edit authorized_keys of the host, it can be used for managing the authorized_keys or updating BTCPay Server directly through the website. (Default: false) BTCPAYGEN_DOCKER_IMAGE: Allows you to specify a custom docker image for the generator (Default: btcpayserver/docker-compose-generator) BTCPAY_IMAGE: Allows you to specify the btcpayserver docker image to use over the default version. (Default: current stable version of btcpayserver, eg. btcpayserver/btcpayserver:version) + BTCPAY_UPDATE_CLEAN: Clean (prune) all old BTCPayServer images after an update. WARNING: also removes all non-BTCPayServer images! (default: true) BTCPAY_PROTOCOL: Allows you to specify the external transport protocol of BTCPayServer. (Default: https) BTCPAY_ADDITIONAL_HOSTS: Allows you to specify additional domains to your BTCPayServer with https support if enabled. (eg. example2.com,example3.com) Add-on specific variables: @@ -206,6 +207,7 @@ fi : "${BTCPAY_ENABLE_SSH:=false}" : "${PIHOLE_SERVERIP:=}" : "${CLOUDFLARE_TUNNEL_TOKEN:=}" +: "${BTCPAY_UPDATE_CLEAN:=true}" OLD_BTCPAY_DOCKER_COMPOSE="$BTCPAY_DOCKER_COMPOSE" ORIGINAL_DIRECTORY="$(pwd)" @@ -311,6 +313,7 @@ BTCPAYGEN_LIGHTNING:$BTCPAYGEN_LIGHTNING BTCPAYGEN_ADDITIONAL_FRAGMENTS:$BTCPAYGEN_ADDITIONAL_FRAGMENTS BTCPAYGEN_EXCLUDE_FRAGMENTS:$BTCPAYGEN_EXCLUDE_FRAGMENTS BTCPAY_IMAGE:$BTCPAY_IMAGE +BTCPAY_UPDATE_CLEAN:$BTCPAY_UPDATE_CLEAN ACME_CA_URI:$ACME_CA_URI TOR_RELAY_NICKNAME: $TOR_RELAY_NICKNAME TOR_RELAY_EMAIL: $TOR_RELAY_EMAIL diff --git a/btcpay-update.sh b/btcpay-update.sh index 26facbd..71028f2 100755 --- a/btcpay-update.sh +++ b/btcpay-update.sh @@ -80,4 +80,4 @@ btcpay_update_docker_env btcpay_up set +e -docker image prune -af --filter "label!=org.btcpayserver.image=docker-compose-generator" +[ "$BTCPAY_UPDATE_CLEAN" == true ] && ./btcpay-clean.sh || exit 0 diff --git a/helpers.sh b/helpers.sh index 49f02c8..d7c14dd 100755 --- a/helpers.sh +++ b/helpers.sh @@ -106,6 +106,7 @@ REVERSEPROXY_HTTPS_PORT=$REVERSEPROXY_HTTPS_PORT REVERSEPROXY_DEFAULT_HOST=$REVERSEPROXY_DEFAULT_HOST NOREVERSEPROXY_HTTP_PORT=$NOREVERSEPROXY_HTTP_PORT BTCPAY_IMAGE=$BTCPAY_IMAGE +BTCPAY_UPDATE_CLEAN=$BTCPAY_UPDATE_CLEAN ACME_CA_URI=$ACME_CA_URI NBITCOIN_NETWORK=$NBITCOIN_NETWORK LETSENCRYPT_EMAIL=$LETSENCRYPT_EMAIL