From 1a2e3810431791e65c156c97de7ddda254eb9e84 Mon Sep 17 00:00:00 2001 From: Kacper Golinski Date: Wed, 3 Jul 2024 23:35:57 +0200 Subject: [PATCH] add HEALTHCHECK instruction to the Dockerfile (#1397) Since Martin gives us `/health` endpoint we could use it by default in the Dockerfile. I've added extra info to the doc about https://github.com/willfarrell/docker-autoheal but not sure if that's ok. I can remove it. --- .github/files/multi-platform.Dockerfile | 1 + docs/src/run-with-docker-compose.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/files/multi-platform.Dockerfile b/.github/files/multi-platform.Dockerfile index b7420a3da..4cbfa89a5 100644 --- a/.github/files/multi-platform.Dockerfile +++ b/.github/files/multi-platform.Dockerfile @@ -4,4 +4,5 @@ ARG TARGETPLATFORM LABEL org.opencontainers.image.description="Blazing fast and lightweight tile server with PostGIS, MBTiles, and PMTiles support" COPY target_releases/$TARGETPLATFORM/* /usr/local/bin +HEALTHCHECK CMD wget --spider http://localhost:3000/health || exit 1 ENTRYPOINT ["/usr/local/bin/martin"] diff --git a/docs/src/run-with-docker-compose.md b/docs/src/run-with-docker-compose.md index 31a6cd2a6..a9f6310fb 100644 --- a/docs/src/run-with-docker-compose.md +++ b/docs/src/run-with-docker-compose.md @@ -40,3 +40,5 @@ docker compose up -d martin ``` By default, Martin will be available at [localhost:3000](http://localhost:3000/) + +Official Docker image includes a `HEALTHCHECK` instruction which will be used by Docker Compose. Note that Compose won't restart unhealthy containers. To monitor and restart unhealthy containers you can use [Docker Autoheal](https://github.com/willfarrell/docker-autoheal).