From 0bdef57b1950c8e79617104db39e17285686fe3f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 14 Aug 2023 16:30:47 +0200 Subject: docker: add HEALTHCHECK --- docker/Dockerfile | 2 ++ docker/cgitize.sh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 46a2215..8cd256d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -49,3 +49,5 @@ ENTRYPOINT ["/sbin/tini", "--", "/in_cron.sh"] WORKDIR /usr/src CMD ["/cgitize.sh"] + +HEALTHCHECK --interval=5m --retries=3 CMD ! test -f /fail diff --git a/docker/cgitize.sh b/docker/cgitize.sh index 92fe43c..be33601 100755 --- a/docker/cgitize.sh +++ b/docker/cgitize.sh @@ -14,6 +14,7 @@ readonly script_dir readonly src_dir=/usr/src readonly cfg_path=/etc/cgitize/cgitize.toml +readonly fail_path=/fail secure_repo_dir() { local dir @@ -29,11 +30,13 @@ secure_repo_dir() { setup() { secure_repo_dir + touch -- "$fail_path" } run() { cd -- "$src_dir" - exec python3 -m cgitize.main "$@" + python3 -m cgitize.main "$@" + rm -f -- "$fail_path" } main() { -- cgit v1.2.3