From d99d6e1a68f20b3f4255296cd22ac80a90adc020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20One=C8=9B?= Date: Sat, 22 Jun 2024 14:18:50 +0300 Subject: [PATCH] perf: optimize the api image health check (#3038) ### Description Having curl installed in the API container improves operations and the efficiency of the health check. Launching python to do a single http call is an overkill. Co-authored-by: Jonas L --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb074eee7..b138599ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -141,6 +141,7 @@ FROM python-base as libretime-api RUN set -eux \ && DEBIAN_FRONTEND=noninteractive apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + curl \ gcc \ libc6-dev \ libpq-dev \ @@ -174,8 +175,7 @@ CMD ["/usr/local/bin/gunicorn", \ ARG LIBRETIME_VERSION ENV LIBRETIME_VERSION=$LIBRETIME_VERSION -HEALTHCHECK CMD ["python3", "-c", \ - "import requests; requests.get('http://localhost:9001/api/v2/version').raise_for_status()"] +HEALTHCHECK CMD ["curl", "--fail", "http://localhost:9001/api/v2/version"] #======================================================================================# # Worker #