Created
June 3, 2020 08:06
-
-
Save andy51002000/3e807221ea54540ccc0f6d9b12313298 to your computer and use it in GitHub Desktop.
check health of service in docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: 'gcr.io/cloud-builders/docker' | |
id: build | |
entrypoint: bash | |
args: | |
- "-c" | |
- | | |
docker run --net=cloudbuild -p 8080:8080 --name srv -d gcr.io/${_PROJECT_NAME}/myapp:${SHORT_SHA} | |
API_STATUS=$(curl --fail -i --retry 3 --retry-delay 2 --retry-connrefused 'http://srv:8080/api/status' | grep HTTP | cut -d' ' -f2) | |
echo "API Status: $$API_STATUS" | |
if [ "200" != "$$API_STATUS" ]; then | |
echo "Error [API status: $$API_STATUS]" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment