2018-01-18 18:42:19 +00:00
|
|
|
#!/usr/bin/env bash
|
2019-12-20 00:10:44 +00:00
|
|
|
# Max amount of time to wait for the Docker container to be built
|
|
|
|
# Allowing 30 polling attempts, 10 seconds delay between each attempt
|
2019-12-19 22:48:03 +00:00
|
|
|
MAX_ATTEMPTS=30
|
|
|
|
|
2019-12-20 00:10:44 +00:00
|
|
|
# Delay (in seconds) between each polling attempt
|
2019-12-19 22:48:03 +00:00
|
|
|
DELAY_SEC=10
|
|
|
|
|
|
|
|
# Counter for the loop that checks if the Docker container had been built
|
|
|
|
count=0
|
|
|
|
|
2020-04-07 22:33:30 +00:00
|
|
|
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8084/?pagename=ready)" != "200" ]]
|
2019-12-19 22:48:03 +00:00
|
|
|
|
2019-12-15 15:32:26 +00:00
|
|
|
do
|
2019-12-19 22:48:03 +00:00
|
|
|
echo "$(date) - Docker container is still being built"
|
|
|
|
sleep ${DELAY_SEC}
|
|
|
|
|
|
|
|
((count++))
|
|
|
|
|
|
|
|
if [[ $count -gt ${MAX_ATTEMPTS} ]]; then
|
|
|
|
echo "$(date) - Docker container couldn't be built"
|
|
|
|
exit
|
|
|
|
fi
|
2019-12-15 15:32:26 +00:00
|
|
|
done
|
2019-12-19 22:48:03 +00:00
|
|
|
|
2020-04-07 18:09:24 +00:00
|
|
|
if [[ $count -gt 0 ]]; then
|
|
|
|
echo "$(date) - Docker container had been built successfully"
|
|
|
|
fi
|