From 7e2c2ea424f4c7a2051e29e447b73b5af224f228 Mon Sep 17 00:00:00 2001 From: Arnaud RITTI Date: Mon, 2 Dec 2024 09:55:28 +0100 Subject: [PATCH] migrate to supervisord --- php/Dockerfile.frankenphp | 10 ++- php/Dockerfile.frankenphp-wkhtmltopdf | 84 +--------------------- php/config/frankenphp/docker-entrypoint.sh | 8 +++ php/config/supervisord/frankenphp.conf | 11 +++ 4 files changed, 29 insertions(+), 84 deletions(-) create mode 100755 php/config/frankenphp/docker-entrypoint.sh create mode 100755 php/config/supervisord/frankenphp.conf diff --git a/php/Dockerfile.frankenphp b/php/Dockerfile.frankenphp index 93ef70a..3490502 100755 --- a/php/Dockerfile.frankenphp +++ b/php/Dockerfile.frankenphp @@ -86,7 +86,15 @@ RUN set -x \ COPY --from=composer /usr/bin/composer /usr/bin/composer COPY config/frankenphp/Caddyfile /etc/caddy/ +COPY config/supervisord.conf /etc/ +COPY config/supervisord/frankenphp.conf /etc/supervisord/ + +COPY config/frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint +RUN chmod +x /usr/local/bin/docker-entrypoint STOPSIGNAL SIGQUIT -CMD ["--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] \ No newline at end of file +HEALTHCHECK CMD curl -f http://localhost:2019/metrics || exit 1 + +ENTRYPOINT ["docker-entrypoint"] +CMD ["-D"] \ No newline at end of file diff --git a/php/Dockerfile.frankenphp-wkhtmltopdf b/php/Dockerfile.frankenphp-wkhtmltopdf index f2bb7fc..805fc1a 100755 --- a/php/Dockerfile.frankenphp-wkhtmltopdf +++ b/php/Dockerfile.frankenphp-wkhtmltopdf @@ -1,84 +1,6 @@ # syntax=docker/dockerfile:1 ARG PHP_VERSION -FROM dunglas/frankenphp:php${PHP_VERSION} - -ENV COMPOSER_ALLOW_SUPERUSER='1' -ENV COMPOSER_MEMORY_LIMIT='-1' -ENV PHP_INI_MEMORY_LIMIT='-1' - -ENV PHP_INI_DATE_TIMEZONE='UTC' -ENV PHP_INI_CGI_FIX_PATHINFO='0' - -ENV PHP_INI_UPLOAD_MAX_FILESIZE='16M' -ENV PHP_INI_POST_MAX_SIZE='16M' - -ENV PHP_INI_ERROR_REPORTING='E_ALL & ~E_DEPRECATED & ~E_STRICT' -ENV PHP_INI_DISPLAY_ERRORS='Off' -ENV PHP_INI_DISPLAY_STARTUP_ERRORS='Off' - -ENV PHP_INI_REALPATH_CACHE_SIZE='4096k' -ENV PHP_INI_REALPATH_CACHE_TTL='120' - -ENV PHP_INI_OPCACHE_MEMORY_CONSUMPTION='128' -ENV PHP_INI_OPCACHE_INTERNED_STRINGS_BUFFER='8' -ENV PHP_INI_OPCACHE_MAX_ACCELERATED_FILES='4000' -ENV PHP_INI_OPCACHE_REVALIDATE_FREQ='60' -ENV PHP_INI_OPCACHE_VALIDATE_TIMESTAMPS='1' -ENV PHP_INI_OPCACHE_FAST_SHUTDOWN='1' -ENV PHP_INI_OPCACHE_ENABLE_CLI='1' -ENV PHP_INI_OPCACHE_ENABLE='1' -ENV PHP_INI_OPCACHE_PRELOAD='' -ENV PHP_INI_OPCACHE_PRELOAD_USER='' - -ENV PHP_INI_SOAP_WSDL_CACHE_ENABLED='1' - -ENV PHP_INI_MAX_EXECUTION_TIME='30' -ENV PHP_INI_MAX_INPUT_TIME='60' - -ENV PHP_INI_SENDMAIL_PATH='sendmail -t -i' - -ENV XDEBUG_REMOTE_AUTOSTART='1' -ENV XDEBUG_REMOTE_PORT='9003' -ENV XDEBUG_START_WITH_REQUEST='trigger' -ENV XDEBUG_MODE='off' - -RUN set -x \ - && apt-get update && apt-get install -y supervisor \ - ca-certificates \ - mime-support \ - libnss3-tools \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -ENV XDG_CONFIG_HOME="/config" -ENV XDG_DATA_HOME="/data" - -ENV SERVER_NAME=":80" -ENV DOCUMENT_ROOT="/var/www/html/" - -ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ -RUN chmod +x /usr/local/bin/install-php-extensions - -WORKDIR /var/www/html - -EXPOSE 80 -EXPOSE 443 -EXPOSE 443/udp -EXPOSE 2019 - -# Use the default production configuration -RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" - -COPY config/php.ini /usr/local/etc/php/conf.d/000-php.ini - -RUN echo "expose_php = Off" > /usr/local/etc/php/conf.d/expose_php.ini - -# Install extensions -RUN set -x \ - install-php-extensions opcache intl gettext zip redis mysqli pgsql pdo_mysql pdo_pgsql gd exif xdebug pcntl - -COPY --from=composer /usr/bin/composer /usr/bin/composer - -COPY config/frankenphp/Caddyfile /etc/caddy/ +FROM adeliom/php:${PHP_VERSION}-frankenphp RUN set -x \ && apt-get update \ @@ -87,7 +9,3 @@ RUN set -x \ imagemagick \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* - -STOPSIGNAL SIGQUIT - -CMD ["--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"] diff --git a/php/config/frankenphp/docker-entrypoint.sh b/php/config/frankenphp/docker-entrypoint.sh new file mode 100755 index 0000000..6ee7ff7 --- /dev/null +++ b/php/config/frankenphp/docker-entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ "${1}" = "-D" ]; then + # start supervisord and services + exec /usr/bin/supervisord -n -c /etc/supervisord.conf +else + exec "$@" +fi diff --git a/php/config/supervisord/frankenphp.conf b/php/config/supervisord/frankenphp.conf new file mode 100755 index 0000000..c1b7d4b --- /dev/null +++ b/php/config/supervisord/frankenphp.conf @@ -0,0 +1,11 @@ +[program:frankenphp] +command=frankenphp run --config /etc/caddy/Caddyfile --adapter caddyfile +autostart=true +autorestart=true +priority=10 +stdout_events_enabled=true +stderr_events_enabled=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 \ No newline at end of file