add healthcheck script
This commit is contained in:
parent
d709598e82
commit
38fc80f338
@ -34,6 +34,6 @@ VOLUME /var/www/app/themes.local
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=5 CMD wget --quiet --tries=1 --spider http://localhost
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD /usr/local/bin/healthcheck.sh
|
||||
WORKDIR /var/www/app
|
||||
CMD []
|
||||
|
14
overlay/usr/local/bin/healthcheck.sh
Executable file
14
overlay/usr/local/bin/healthcheck.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
URL=http://localhost
|
||||
|
||||
wget --quiet --tries=1 --spider ${URL}
|
||||
[ $? -ne 0 ] && exit 1
|
||||
|
||||
CONTENT=$(wget --quiet -O - ${URL})
|
||||
case "$CONTENT" in
|
||||
*Exception*) exit 1 ;;
|
||||
esac
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user