Modernize images and move PHP 8.1 to legacy
Tests / integration (8.2, alpine) (push) Canceled after 0s
Tests / integration (8.2, debian) (push) Canceled after 0s
Tests / integration (8.3, alpine) (push) Canceled after 0s
Tests / integration (8.3, debian) (push) Canceled after 0s
Tests / integration (8.4, alpine) (push) Canceled after 0s
Tests / integration (8.4, debian) (push) Canceled after 0s
Tests / integration (8.5, alpine) (push) Canceled after 0s
Tests / integration (8.5, debian) (push) Canceled after 0s

PHP 8.1 is end-of-life. It is dropped from the default build and test
matrices. 8.1 and 8.1-alpine are still built, multi-arch, by the
manual legacy job (workflow_dispatch with legacy=true), together with
7.2, 7.3, 7.4 and 8.0. This replaces manual-build.yml.
This commit is contained in:
jkaninda committed 2026-10-22 05:30:34 +02:00
1 parent c602e1a0ad
commit 5abd5bc076
24 files changed
+857 -595

No files matched your search

+99
View File
@@ -0,0 +1,99 @@
# syntax=docker/dockerfile:1
ARG phpVersion=8.5
FROM composer:2 AS composer
FROM php:${phpVersion}-fpm-alpine
ARG WORKDIR=/var/www/html
ARG GROUP_ID=1000
ARG USER_ID=1000
ARG GROUP_NAME=www-data
LABEL org.opencontainers.image.title="nginx-php-fpm" \
org.opencontainers.image.description="Nginx and PHP-FPM image for Laravel and PHP applications (Alpine)" \
org.opencontainers.image.source="https://github.com/jkaninda/nginx-php-fpm" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.authors="Jonas Kaninda"
ENV APP_DIR=${WORKDIR} \
USER_NAME=www-data \
DOMAIN=_ \
CLIENT_MAX_BODY_SIZE=15M \
LARAVEL_PROCS_NUMBER=1 \
LARAVEL_QUEUE_WORKER_ENABLED=true \
LARAVEL_QUEUE_OPTIONS="--sleep=3 --tries=3" \
LARAVEL_SCHEDULER_ENABLED=true \
PHP_DATE_TIMEZONE=UTC \
PHP_DISPLAY_ERRORS=Off \
PHP_MEMORY_LIMIT=256M \
PHP_UPLOAD_MAX_FILESIZE=80M \
PHP_POST_MAX_SIZE=80M \
PHP_MAX_EXECUTION_TIME=30 \
PHP_OPCACHE_ENABLE=1 \
PHP_OPCACHE_ENABLE_CLI=0 \
PHP_OPCACHE_MEMORY_CONSUMPTION=512 \
PHP_OPCACHE_MAX_ACCELERATED_FILES=50000 \
PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 \
PHP_OPCACHE_REVALIDATE_FREQ=0 \
PHP_FPM_PM=dynamic \
PHP_FPM_PM_MAX_CHILDREN=20 \
PHP_FPM_PM_START_SERVERS=2 \
PHP_FPM_PM_MIN_SPARE_SERVERS=1 \
PHP_FPM_PM_MAX_SPARE_SERVERS=3 \
PHP_FPM_PM_MAX_REQUESTS=500
# Runtime tools, Nginx and Node.js
RUN apk add --no-cache bash curl git openssh-client unzip zip nginx supervisor sqlite nano nodejs npm
# PHP extensions (build dependencies are removed, runtime libraries are kept)
RUN set -eux; \
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
freetype-dev libjpeg-turbo-dev libpng-dev libwebp-dev \
icu-dev libmemcached-dev oniguruma-dev libpq-dev librdkafka-dev \
libxml2-dev libzip-dev zlib-dev cyrus-sasl-dev linux-headers; \
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j"$(nproc)" bcmath exif gd intl mbstring pcntl pdo_mysql pdo_pgsql zip; \
pecl install redis memcached rdkafka; \
docker-php-ext-enable redis memcached rdkafka; \
# OPcache is always compiled in since PHP 8.5
if ! php -m | grep -qi '^zend opcache$'; then docker-php-ext-install opcache; fi; \
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' | sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache --virtual .php-ext-rundeps $runDeps; \
apk del --no-network .build-deps; \
rm -rf /tmp/pear ~/.pearrc; \
! php -m 2>&1 | grep -iE 'warning|unable to load'
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
WORKDIR $WORKDIR
RUN rm -Rf /var/www/* /etc/nginx/http.d/default.conf && \
mkdir -p ${WORKDIR} /etc/supervisor/conf.d /var/log/supervisor /var/log/nginx /var/cache/nginx /etc/nginx/conf.d
COPY src/index.php $WORKDIR/index.php
COPY src/php.ini src/opcache.ini $PHP_INI_DIR/conf.d/
COPY src/php-fpm.d/zz-nginx-php-fpm.conf /usr/local/etc/php-fpm.d/zz-nginx-php-fpm.conf
COPY src/nginx.conf /etc/nginx/nginx.conf
COPY src/supervisor/supervisord.conf /etc/supervisor/supervisord.conf
COPY --chmod=755 src/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN ln -s /usr/local/bin/entrypoint.sh /entrypoint.sh && \
ln -sf /etc/supervisor/supervisord.conf /etc/supervisord.conf
RUN apk add --no-cache --virtual .user-deps shadow && \
usermod -u ${USER_ID} ${USER_NAME} && \
groupmod -g ${GROUP_ID} ${GROUP_NAME} && \
apk del --no-network .user-deps && \
touch /var/run/nginx.pid && \
chown -R ${USER_NAME}:${GROUP_NAME} /var/www /var/log /tmp $PHP_INI_DIR/conf.d \
/etc/supervisor/conf.d /etc/nginx/nginx.conf /etc/nginx/conf.d \
/var/cache/nginx /var/lib/nginx /var/run/nginx.pid
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --start-interval=2s --retries=3 \
CMD php -r 'exit(@fsockopen("127.0.0.1", 9000) && @fsockopen("127.0.0.1", 80) ? 0 : 1);'
EXPOSE 80
ENTRYPOINT ["entrypoint.sh"]
CMD ["entrypoint"]