diff --git a/docker/build.dockerfile b/docker/build.dockerfile index 5e74187..381966c 100644 --- a/docker/build.dockerfile +++ b/docker/build.dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/flibusta-apps/base_docker_images:3.11-postgres-asyncpg-poetry-buildtime as build-image +FROM ghcr.io/flibusta-apps/base_docker_images:3.11-postgres-asyncpg-poetry-buildtime AS build-image WORKDIR /root/poetry COPY pyproject.toml poetry.lock /root/poetry/ @@ -10,7 +10,7 @@ RUN poetry export --without-hashes > requirements.txt \ && pip install -r requirements.txt --no-cache-dir -FROM ghcr.io/flibusta-apps/base_docker_images:3.11-postgres-runtime as runtime-image +FROM ghcr.io/flibusta-apps/base_docker_images:3.11-postgres-runtime AS runtime-image WORKDIR /app @@ -24,4 +24,6 @@ COPY --from=build-image $VENV_PATH $VENV_PATH EXPOSE 8080 +HEALTHCHECK CMD python3 /root/healthcheck.py + CMD bash /root/start.sh diff --git a/scripts/healthcheck.py b/scripts/healthcheck.py index 6f2f501..9938d7c 100644 --- a/scripts/healthcheck.py +++ b/scripts/healthcheck.py @@ -1,8 +1,11 @@ +import os + import httpx -response = httpx.get( - "http://localhost:8080/healthcheck", -) -print(f"HEALTHCHECK STATUS: {response.status_code}") +CHECK_URL = os.environ.get("HEALTHCHECK_URL", "http://localhost:8080/healthcheck") + +response = httpx.get(CHECK_URL) + +print(f"HEALTHCHECK STATUS: {response.text}") exit(0 if response.status_code == 200 else 1)