Add healthcheck command (#2856)

Currently vikunja has a `/health` endpoint that was added in https://kolaente.dev/vikunja/vikunja/pulls/998. Docker/compose cannot utilize this feature since vikunja's docker image doesn't have curl/wget as it is pruned which is great for the image size. This PR adds a `healthcheck` command that send an http request to `/health` and exits with 0 or non-zero depending on the result.
It also adds a `HEALTHCHECK` to the docker image which calls this automatically.

Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2856
Reviewed-by: konrad <k@knt.li>
Co-authored-by: ScribblerCoder <omar2001.oh@gmail.com>
Co-committed-by: ScribblerCoder <omar2001.oh@gmail.com>
This commit is contained in:
ScribblerCoder
2024-11-20 18:04:55 +00:00
committed by konrad
parent e124ad4df9
commit a5cc5e3783
2 changed files with 66 additions and 0 deletions

View File

@@ -53,3 +53,5 @@ ENV VIKUNJA_DATABASE_PATH=/db/vikunja.db
COPY --from=apibuilder /build/vikunja-* vikunja
COPY --from=apibuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
CMD [ "/app/vikunja/vikunja", "healthcheck" ]