From cde606be8cdfea68d1eb3d6606d923ee09dcf7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A8ve=20Caillault?= Date: Sun, 25 Oct 2026 15:40:40 +0100 Subject: [PATCH] =?UTF-8?q?Installation=20de=20Supercronic=20pour=20la=20g?= =?UTF-8?q?estion=20des=20t=C3=A2ches=20planifi=C3=A9es.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 19 ++++++++++++++++++- scripts/server-php-entrypoint.sh | 16 ++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 scripts/server-php-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 70d4d8f..cddd6be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,4 +78,21 @@ RUN mkdir -p /var/www/.cache/composer /var/www/.cache/npm \ ENV COMPOSER_CACHE_DIR=/var/www/.cache/composer # Configuration pour NPM -ENV NPM_CONFIG_CACHE=/var/www/.cache/npm \ No newline at end of file +ENV NPM_CONFIG_CACHE=/var/www/.cache/npm + +# Configuration de Supercronic pour la gestion des tâches planifiées +ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.44/supercronic-linux-amd64 \ + SUPERCRONIC_SHA1SUM=6eb0a8e1e6673675dc67668c1a9b6409f79c37bc \ + SUPERCRONIC=supercronic-linux-amd64 + +RUN curl -fsSLO "$SUPERCRONIC_URL" \ + && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ + && chmod +x "$SUPERCRONIC" \ + && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ + && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic + +COPY scripts/server-php-entrypoint.sh /usr/local/bin/server-php-entrypoint + +RUN chmod +x /usr/local/bin/server-php-entrypoint + +ENTRYPOINT ["server-php-entrypoint"] \ No newline at end of file diff --git a/scripts/server-php-entrypoint.sh b/scripts/server-php-entrypoint.sh new file mode 100644 index 0000000..4c5209b --- /dev/null +++ b/scripts/server-php-entrypoint.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +supercronic /etc/crontab & + +if command -v apache2-foreground >/dev/null 2>&1; then + exec docker-php-entrypoint apache2-foreground +fi + +if command -v frankenphp >/dev/null 2>&1; then + exec frankenphp run --config /etc/caddy/Caddyfile +fi + +echo "Impossible de déterminer le serveur PHP à démarrer." >&2 +exit 1 \ No newline at end of file