From 424642d3b9abba9119ec78b385725cdb755ebafa Mon Sep 17 00:00:00 2001 From: Casper Meijn Date: Tue, 24 Dec 2024 16:56:22 +0100 Subject: [PATCH] Add healthcheck to image - Move the healthcheck from the docker-compose example to the actual image. That makes sure all user of the image automatically get the healthcheck. - Change to `curl --fail || exit 1` as suggested in [docker documentation](https://docs.docker.com/reference/dockerfile/#healthcheck) - Add `--silent --show-error` so that docker health state contains the output of the HTTP call instead of curl progress bar - Set the user agent to make the logs more readable --- Dockerfile | 2 ++ README.md | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b669ff5..1ec0156 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,6 +83,8 @@ ENV PATH="${PATH}:/var/www/wallabag/bin" # Set console entry path WORKDIR /var/www/wallabag +HEALTHCHECK CMD curl --fail --silent --show-error --user-agent healthcheck http://localhost/api/info || exit 1 + EXPOSE 80 ENTRYPOINT ["/entrypoint.sh"] CMD ["wallabag"] diff --git a/README.md b/README.md index a70d884..51c78e3 100644 --- a/README.md +++ b/README.md @@ -132,10 +132,6 @@ services: - "80" volumes: - /opt/wallabag/images:/var/www/wallabag/web/assets/images - healthcheck: - test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost/api/info"] - interval: 1m - timeout: 3s depends_on: - db - redis