fix healt in compose

This commit is contained in:
Mateusz Gruszczyński
2025-12-24 22:55:20 +01:00
parent 21434588fc
commit c5295fa49c

View File

@@ -7,7 +7,13 @@ services:
expose: expose:
- "${APP_PORT}" - "${APP_PORT}"
healthcheck: healthcheck:
test: [ "CMD", "python", "-c", "import urllib.request; import sys; req = urllib.request.Request('http://localhost:${APP_PORT}/healthcheck', headers={'X-Internal-Check': '${HEALTHCHECK_TOKEN}'}); sys.exit(0) if urllib.request.urlopen(req).read() == b'OK' else sys.exit(1)" ] test:
[
"CMD",
"python",
"-c",
"import urllib.request; import sys; req = urllib.request.Request('http://localhost:${APP_PORT:-8080}/healthcheck', headers={'X-Internal-Check': '${HEALTHCHECK_TOKEN}'}); sys.exit(0) if urllib.request.urlopen(req).getcode() == 200 else sys.exit(1)",
]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3