[Update] Prefetch images, big thanks to everyone in #2637!

master
andryyy 2019-05-25 22:29:25 +02:00
parent 57d65535c9
commit 5b730bf89f
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 15 additions and 0 deletions

View File

@ -9,6 +9,9 @@ fi
# Exit on error and pipefail
set -o pipefail
# Setting high dc timeout
export COMPOSE_HTTP_TIMEOUT=300
# Add /opt/bin to PATH
PATH=$PATH:/opt/bin
@ -292,6 +295,18 @@ if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
exit 0
fi
echo -e "\e[32mPrefetching images...\e[0m"
while read image; do
RET_C=0
until docker pull ${image}; do
RET_C=$((RET_C + 1))
echo -e "\e[33m\nError pulling $image, retrying...\e[0m"
[ ${RET_C} -gt 3 ] && { echo -e "\e[31m\nToo many failed retries, exiting\e[0m"; exit 1; }
sleep 1
done
done < <(git show origin/${BRANCH}:docker-compose.yml | grep "image:" | awk '{ gsub("image:","", $3); print $2 }')
echo -e "Stopping mailcow... "
sleep 2
docker-compose down