diff --git a/apache/Dockerfile b/apache/Dockerfile index 9b59410..78e3272 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -1,12 +1,9 @@ # Use PHP with Apache as the base image FROM php:8.4-apache -# Application root (default keeps the original /var/www/html layout) -ENV APP_ROOT="/var/www/html" - # Environment ENV TZ="Europe/Prague" \ - APACHE_DOCUMENT_ROOT="${APP_ROOT}/public" \ + APACHE_DOCUMENT_ROOT="/var/www/html/public" \ PHP_INI_FILE="$PHP_INI_DIR/php.ini" \ PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \ PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \ @@ -117,7 +114,7 @@ COPY ./supervisor/conf.d/laravel-queues.conf /etc/supervisor/conf.d/laravel-queu # Setup Crone RUN mkdir -p /var/log/cron && \ -echo "* * * * * www-data cd ${APP_ROOT} && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1" >> /etc/crontab +echo "* * * * * www-data cd /var/www/html && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1" >> /etc/crontab # Install composer # bun RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer diff --git a/apache/supervisor/conf.d/laravel-queues.conf b/apache/supervisor/conf.d/laravel-queues.conf index f11adc6..74d99b5 100644 --- a/apache/supervisor/conf.d/laravel-queues.conf +++ b/apache/supervisor/conf.d/laravel-queues.conf @@ -1,19 +1,19 @@ [program:queue-default] -command=/usr/local/bin/php %(ENV_APP_ROOT)s/artisan queue:work --sleep=3 --tries=3 --queue=default,importstatistics +command=/usr/local/bin/php /var/www/html/artisan queue:work --sleep=3 --tries=3 --queue=default,importstatistics user=www-data autostart=true autorestart=true stdout_logfile=/var/log/supervisor/queue-default.log [program:queue-statistics] -command=/usr/local/bin/php %(ENV_APP_ROOT)s/artisan queue:work --sleep=5 --tries=3 --queue=statistics +command=/usr/local/bin/php /var/www/html/artisan queue:work --sleep=5 --tries=3 --queue=statistics user=www-data autostart=true autorestart=true stdout_logfile=/var/log/supervisor/queue-statistics.log [program:queue-detections] -command=/usr/local/bin/php %(ENV_APP_ROOT)s/artisan queue:work --sleep=3 --tries=3 --queue=detections +command=/usr/local/bin/php /var/www/html/artisan queue:work --sleep=3 --tries=3 --queue=detections user=www-data autostart=true autorestart=true diff --git a/fmp-alpine/Dockerfile b/fmp-alpine/Dockerfile index 40a7fff..eececbf 100644 --- a/fmp-alpine/Dockerfile +++ b/fmp-alpine/Dockerfile @@ -1,12 +1,6 @@ FROM php:8.4-fpm-alpine -# Application root (same default as the apache image) -ENV APP_ROOT="/var/www/html" - ENV TZ="Europe/Prague" \ - ENABLE_CRON=0 \ - ENABLE_SUPERVISOR=0 \ - COMPOSER_ALLOW_SUPERUSER=1 \ PHP_OPCACHE_ENABLE=1 \ PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 \ PHP_OPCACHE_REVALIDATE_FREQ=0 \ @@ -31,17 +25,7 @@ RUN apk add --no-cache \ libpng \ icu \ oniguruma \ - libxml2 \ - libwebp \ - git \ - nano \ - zip \ - unzip \ - nodejs \ - npm \ - supervisor \ - mysql-client \ - postgresql-client + libxml2 RUN apk add --no-cache --virtual .build-deps \ $PHPIZE_DEPS \ @@ -49,14 +33,13 @@ RUN apk add --no-cache --virtual .build-deps \ libzip-dev \ freetype-dev \ libjpeg-turbo-dev \ - libwebp-dev \ libpng-dev \ icu-dev \ libxml2-dev \ linux-headers RUN docker-php-ext-configure \ - gd --with-freetype --with-jpeg --with-webp \ + gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) \ pdo_mysql \ pdo_pgsql \ @@ -76,13 +59,6 @@ RUN pecl install imagick \ RUN apk del .build-deps -# Fail fast if the JPEG delegate did not make it into the image -RUN php -r 'if (!in_array("JPEG", Imagick::queryFormats())) { fwrite(STDERR, "ERROR: imagick built without JPEG delegate\n"); exit(1); } echo "imagick JPEG delegate OK\n";' && \ - php -r 'if (!function_exists("imagecreatefromjpeg")) { fwrite(STDERR, "ERROR: gd built without JPEG support\n"); exit(1); } echo "gd JPEG OK\n";' - -# Composer -COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer - RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ && echo "date.timezone=${TZ}" > "$PHP_INI_DIR/conf.d/99-timezone.ini" @@ -105,22 +81,4 @@ RUN { \ echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \ echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \ echo "opcache.save_comments=1"; \ -} > "$PHP_INI_DIR/conf.d/10-opcache.ini" - -# Supervisor (queue workers, started when ENABLE_SUPERVISOR=1) -RUN mkdir -p /var/log/supervisor -COPY ./supervisor/supervisord.conf /etc/supervisor/supervisord.conf -COPY ./supervisor/conf.d/laravel-queues.conf /etc/supervisor/conf.d/laravel-queues.conf - -# Cron (Laravel scheduler, started when ENABLE_CRON=1) -RUN mkdir -p /var/log/cron && \ - echo "* * * * * cd ${APP_ROOT} && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1" > /etc/crontabs/www-data - -# Entrypoint -COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh -RUN chmod +x /usr/local/bin/docker-entrypoint.sh - -WORKDIR ${APP_ROOT} - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["php-fpm"] +} > "$PHP_INI_DIR/conf.d/10-opcache.ini" \ No newline at end of file diff --git a/fmp-alpine/docker-entrypoint.sh b/fmp-alpine/docker-entrypoint.sh deleted file mode 100644 index 76dc355..0000000 --- a/fmp-alpine/docker-entrypoint.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -set -e - -# Optional background services, only started together with php-fpm so that -# one-off commands (php artisan ..., composer ...) are passed through untouched. -case "$1" in - php-fpm*) - if [ "${ENABLE_CRON:-0}" = "1" ]; then - crond -b -L /var/log/cron/cron.log - fi - if [ "${ENABLE_SUPERVISOR:-0}" = "1" ]; then - supervisord -c /etc/supervisor/supervisord.conf - fi - ;; -esac - -exec docker-php-entrypoint "$@" diff --git a/fmp-alpine/supervisor/conf.d/laravel-queues.conf b/fmp-alpine/supervisor/conf.d/laravel-queues.conf deleted file mode 100644 index f11adc6..0000000 --- a/fmp-alpine/supervisor/conf.d/laravel-queues.conf +++ /dev/null @@ -1,20 +0,0 @@ -[program:queue-default] -command=/usr/local/bin/php %(ENV_APP_ROOT)s/artisan queue:work --sleep=3 --tries=3 --queue=default,importstatistics -user=www-data -autostart=true -autorestart=true -stdout_logfile=/var/log/supervisor/queue-default.log - -[program:queue-statistics] -command=/usr/local/bin/php %(ENV_APP_ROOT)s/artisan queue:work --sleep=5 --tries=3 --queue=statistics -user=www-data -autostart=true -autorestart=true -stdout_logfile=/var/log/supervisor/queue-statistics.log - -[program:queue-detections] -command=/usr/local/bin/php %(ENV_APP_ROOT)s/artisan queue:work --sleep=3 --tries=3 --queue=detections -user=www-data -autostart=true -autorestart=true -stdout_logfile=/var/log/supervisor/queue-detections.log \ No newline at end of file diff --git a/fmp-alpine/supervisor/supervisord.conf b/fmp-alpine/supervisor/supervisord.conf deleted file mode 100644 index 2e99660..0000000 --- a/fmp-alpine/supervisor/supervisord.conf +++ /dev/null @@ -1,6 +0,0 @@ -[supervisord] -logfile=/var/log/supervisor/supervisord.log -pidfile=/run/supervisord.pid - -[include] -files = /etc/supervisor/conf.d/*.conf