mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
Add healthcheck
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user