add HEALTHCHECK parameters

This commit is contained in:
ElevenNotes
2023-06-15 23:36:14 +02:00
parent 2c6c3ebf69
commit 35ee447e50
2 changed files with 15 additions and 3 deletions

View File

@@ -22,6 +22,14 @@ docker run --name nginx \
| `uid` | 1000 | user id 1000 |
| `gid` | 1000 | group id 1000 |
## Environment
| Parameter | Value |Default |
| --- | --- | --- |
| `HEALTHCHECK_PROTO` | http or https | http |
| `HEALTHCHECK_HOST` | localhost or 127.0.0.1 or a dedicated IP | localhost |
| `HEALTHCHECK_PORT` | any TCP port | 8080 |
| `HEALTHCHECK_URL` | any URL, must start with / | / |
## Delta
Additional plugins:
@@ -33,8 +41,8 @@ Additional plugins:
* [11notes/alpine:stable](https://github.com/11notes/docker-alpine)
## Built with
* [nginx](https://nginx.org/)
* [Alpine Linux](https://alpinelinux.org/)
* [nginx](https://nginx.org)
* [Alpine Linux](https://alpinelinux.org)
## Tips
* You can find some [examples](examples) of special backend configurations

View File

@@ -1,2 +1,6 @@
#!/bin/ash
curl --max-time 5 -kILs --fail http://localhost:8080
if [ -z "${HEALTHCHECK_PROTO}" ]; then HEALTHCHECK_PROTO=http; fi
if [ -z "${HEALTHCHECK_HOST}" ]; then HEALTHCHECK_HOST=localhost; fi
if [ -z "${HEALTHCHECK_PORT}" ]; then HEALTHCHECK_PORT=8080; fi
if [ -z "${HEALTHCHECK_URL}" ]; then HEALTHCHECK_URL=/; fi
curl --max-time 5 -kILs --fail ${HEALTHCHECK_PROTO}://${HEALTHCHECK_HOST}:${HEALTHCHECK_PORT}${HEALTHCHECK_URL}