From 37ca0678f7ccd8f4bdda523c153d1f28f72a4970 Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Fri, 15 Dec 2023 16:44:06 -0500 Subject: [PATCH] Only pull image when needed. --- www/generate_certs.sh | 5 ++++- www/stub/ghost_yml.sh | 5 +++-- www/stub/gitea_yml.sh | 9 +++++++-- www/stub/nextcloud_yml.sh | 6 +++--- www/stub/nginx_yml.sh | 4 +++- www/stub/nostr_yml.sh | 4 +++- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/www/generate_certs.sh b/www/generate_certs.sh index c13f10a..b39350c 100755 --- a/www/generate_certs.sh +++ b/www/generate_certs.sh @@ -3,7 +3,10 @@ set -e # let's do a refresh of the certificates. Let's Encrypt will not run if it's not time. -docker pull certbot/certbot:latest +CERTBOT_IMAGE_NAME="certbot/certbot:latest" +if ! docker image inspect "$CERTBOT_IMAGE_NAME" &> /dev/null; then + docker pull "$CERTBOT_IMAGE_NAME" +fi # iterate over each domain and call certbot for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do diff --git a/www/stub/ghost_yml.sh b/www/stub/ghost_yml.sh index ea12325..dfd3415 100755 --- a/www/stub/ghost_yml.sh +++ b/www/stub/ghost_yml.sh @@ -3,8 +3,9 @@ set -eu cd "$(dirname "$0")" - -docker pull "$GHOST_IMAGE" +if ! docker image inspect "$GHOST_IMAGE" &> /dev/null; then + docker pull "$GHOST_IMAGE" +fi DEPLOY_STACK=false for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do diff --git a/www/stub/gitea_yml.sh b/www/stub/gitea_yml.sh index ab0904a..e5e1e74 100755 --- a/www/stub/gitea_yml.sh +++ b/www/stub/gitea_yml.sh @@ -4,8 +4,13 @@ set -eu cd "$(dirname "$0")" -docker pull "$GITEA_IMAGE" -docker pull "$GITEA_DB_IMAGE" +if ! docker image inspect "$GITEA_IMAGE" &> /dev/null; then + docker pull "$GITEA_IMAGE" +fi + +if ! docker image inspect "$GITEA_DB_IMAGE" &> /dev/null; then + docker pull "$GITEA_DB_IMAGE" +fi for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do export DOMAIN_NAME="$DOMAIN_NAME" diff --git a/www/stub/nextcloud_yml.sh b/www/stub/nextcloud_yml.sh index 8b3de22..74f2b35 100755 --- a/www/stub/nextcloud_yml.sh +++ b/www/stub/nextcloud_yml.sh @@ -3,9 +3,9 @@ set -eu cd "$(dirname "$0")" - -docker pull "$NEXTCLOUD_IMAGE" - +if ! docker image inspect "$NEXTCLOUD_IMAGE" &> /dev/null; then + docker pull "$NEXTCLOUD_IMAGE" +fi for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do export DOMAIN_NAME="$DOMAIN_NAME" diff --git a/www/stub/nginx_yml.sh b/www/stub/nginx_yml.sh index 7d792de..31423ea 100755 --- a/www/stub/nginx_yml.sh +++ b/www/stub/nginx_yml.sh @@ -3,7 +3,9 @@ set -e cd "$(dirname "$0")" -docker pull "$NGINX_IMAGE" +if ! docker image inspect "$NEXTCLOUD_IMAGE" &> /dev/null; then + docker pull "$NGINX_IMAGE" +fi #https://github.com/fiatjaf/expensive-relay # NOSTR RELAY WHICH REQUIRES PAYMENTS. diff --git a/www/stub/nostr_yml.sh b/www/stub/nostr_yml.sh index c1a2036..15a1d27 100755 --- a/www/stub/nostr_yml.sh +++ b/www/stub/nostr_yml.sh @@ -3,7 +3,9 @@ set -eu cd "$(dirname "$0")" -docker pull "$NOSTR_RELAY_IMAGE" +if ! docker image inspect "$NOSTR_RELAY_IMAGE" &> /dev/null; then + docker pull "$NOSTR_RELAY_IMAGE" +fi for DOMAIN_NAME in ${DOMAIN_LIST//,/ }; do export DOMAIN_NAME="$DOMAIN_NAME"