From 3cd3decca1e21059ea50404d9f539aadc5529816 Mon Sep 17 00:00:00 2001 From: sky Date: Sun, 14 Sep 2025 02:38:35 +0200 Subject: [PATCH] =?UTF-8?q?healthcheck=20mis=20dans=20le=20Dockerfile=20?= =?UTF-8?q?=C3=A0=20la=20place=20d'un=20scripte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- healthcheck.py | 27 --------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) delete mode 100755 healthcheck.py diff --git a/Dockerfile b/Dockerfile index 3f77c79..5acb543 100755 --- a/Dockerfile +++ b/Dockerfile @@ -30,12 +30,12 @@ COPY ./webapp ./webapp COPY ./twitchbot ./twitchbot COPY zabbix_agent2.conf /etc/zabbix/zabbix_agent2.conf COPY start.sh /start.sh -COPY healthcheck.py . RUN python3 -m venv /app/venv && \ /app/venv/bin/pip install --no-cache-dir -r requirements.txt && \ chmod +x /start.sh -HEALTHCHECK --interval=30s --timeout=10s --start-period=2m CMD /app/venv/bin/python /app/healthcheck.py +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD pgrep python > /dev/null || exit 1 CMD ["/start.sh"] diff --git a/healthcheck.py b/healthcheck.py deleted file mode 100755 index 16ae63d..0000000 --- a/healthcheck.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 - -import subprocess -import sys -import os - -def check_process(): - """Vérifie si le processus Python principal est en cours d'exécution""" - try: - # Vérifier si un processus python est actif - result = subprocess.run( - ["pgrep", "python"], - capture_output=True, - text=True - ) - return result.returncode == 0 - except Exception: - return False - -def main(): - if check_process(): - sys.exit(0) # Succès - else: - sys.exit(1) # Échec - -if __name__ == "__main__": - main() \ No newline at end of file