diff --git a/README.md b/README.md index 5bac7e4..46f8ff8 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ multi-stage builds, pinned dependencies, and non-root users. | [dnscrypt-proxy](dockerfiles/dnscrypt-proxy) | [DNSCrypt](https://dnscrypt.info/) proxy with encrypted DNS support | | [memcached](dockerfiles/memcached) | [Memcached](https://memcached.org/) with built-in proxy support and embedded [routelib](https://github.com/memcached/memcached-proxylibs) | | [paperless-ngx](dockerfiles/paperless-ngx) | [Paperless-ngx](https://docs.paperless-ngx.com/) document management system | -| [php-lol](dockerfiles/php-lol) | PHP-FPM with Nginx and common extensions (8.3, 8.4) | +| [php-lol](dockerfiles/php-lol) | PHP-FPM with Nginx and common extensions (8.3, 8.4, 8.5) | | [pingdom-exporter](dockerfiles/pingdom-exporter) | Prometheus exporter for Pingdom metrics | | [pint](dockerfiles/pint) | [Pint](https://cloudflare.github.io/pint/) – Prometheus rule linter by Cloudflare | | [python-github-backup](dockerfiles/python-github-backup) | [python-github-backup](https://github.com/josegonzalez/python-github-backup) – GitHub repository backup tool | diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 746945f..bef51ba 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -30,6 +30,13 @@ services: dockerfile: Dockerfile.8.4 image: bdossantos/php-lol container_name: php-lol84 + php-lol85: + <<: *default + build: + context: dockerfiles/php-lol + dockerfile: Dockerfile.8.5 + image: bdossantos/php-lol + container_name: php-lol85 pingdom-exporter: <<: *default build: diff --git a/dockerfiles/php-lol/Dockerfile.8.5 b/dockerfiles/php-lol/Dockerfile.8.5 new file mode 100644 index 0000000..965abc8 --- /dev/null +++ b/dockerfiles/php-lol/Dockerfile.8.5 @@ -0,0 +1,320 @@ +# +# Foundation +# +FROM php:8.5.10-fpm-bookworm@sha256:8e780a6e59508f418c7729681468322a2ce7d7cfe4266025054f41bbe85e3928 AS foundation + +ENV \ + AMQP_VERSION=2.2.0 \ + APCU_VERSION=5.1.28 \ + APP_DIR=/usr/src/app \ + IGBINARY_VERSION=3.2.17RC1 \ + IMAP_VERSION=1.0.3 \ + LIBMAXMINDDB_VERSION=1.7.1 \ + MAILPARSE_VERSION=3.2.0 \ + MEMCACHED_VERSION=3.4.0 \ + MSGPACK_VERSION=3.0.0 \ + NGINX_VERSION=1.30.4 \ + NGX_HTTP_GEOIP2_MODULE_VERSION=3.4 \ + REDIS_VERSION=6.3.0 \ + VERSION=8.5.10 \ + ZSTD_VERSION=0.15.2 + +ENV BUILD_DEPENDENCIES="\ + automake \ + build-essential \ + bzip2 \ + cmake \ + curl \ + libbz2-dev \ + libc-client-dev \ + libgeoip-dev \ + libgmp-dev \ + libicu-dev \ + libjpeg-dev \ + libkrb5-dev \ + liblz4-dev \ + libmemcached-dev \ + libpcre3-dev \ + libpng-dev \ + libpq-dev \ + librabbitmq-dev \ + libssl-dev \ + libtidy-dev \ + libuv1-dev \ + libxml2-dev \ + libzip-dev \ + libzstd-dev \ + zlib1g-dev" + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# hadolint ignore=DL3003,DL3008 +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + acl \ + bash \ + geoip-database \ + git \ + imagemagick \ + libaio1 \ + libfontconfig \ + libjpeg-turbo-progs \ + libmagickcore-dev \ + libmagickwand-dev \ + libodbc1 \ + libpq5 \ + librabbitmq4 \ + libtool \ + locales \ + supervisor \ + unzip \ + $BUILD_DEPENDENCIES \ + && docker-php-ext-install -j"$(nproc)" zip \ + && mkdir -p /var/lib/php/session \ + && chown -R www-data.www-data /var/lib/php/session \ + # pickle is incompatible with PHP 8.5 (it bundles Composer 1.x, which is not + # compatible with PHP 8.5), so PECL extensions are built from pinned upstream + # sources with phpize instead. + && git clone --depth 1 --branch "${IGBINARY_VERSION}" \ + https://github.com/igbinary/igbinary /usr/src/igbinary \ + && pushd /usr/src/igbinary \ + && phpize \ + && ./configure \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && git clone --depth 1 --branch "msgpack-${MSGPACK_VERSION}" \ + https://github.com/msgpack/msgpack-php /usr/src/msgpack \ + && pushd /usr/src/msgpack \ + && phpize \ + && ./configure \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && git clone --depth 1 --branch "v${APCU_VERSION}" \ + https://github.com/krakjoe/apcu /usr/src/apcu \ + && pushd /usr/src/apcu \ + && phpize \ + && ./configure \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && git clone --depth 1 --branch "v${AMQP_VERSION}" \ + https://github.com/php-amqp/php-amqp /usr/src/amqp \ + && pushd /usr/src/amqp \ + && phpize \ + && ./configure \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && git clone --depth 1 --branch "${IMAP_VERSION}" \ + https://github.com/php/pecl-mail-imap /usr/src/imap \ + && pushd /usr/src/imap \ + && phpize \ + && ./configure --with-imap --with-imap-ssl --with-kerberos \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && git clone --depth 1 --branch "v${MEMCACHED_VERSION}" \ + https://github.com/php-memcached-dev/php-memcached /usr/src/memcached \ + && pushd /usr/src/memcached \ + && phpize \ + && ./configure --enable-memcached-igbinary --enable-memcached-msgpack \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && git clone --depth 1 --branch "${REDIS_VERSION}" \ + https://github.com/phpredis/phpredis /usr/src/redis \ + && pushd /usr/src/redis \ + && phpize \ + && ./configure --enable-redis-igbinary --enable-redis-msgpack \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && git clone --depth 1 --branch "v${MAILPARSE_VERSION}" \ + https://github.com/php/pecl-mail-mailparse /usr/src/mailparse \ + && pushd /usr/src/mailparse \ + && phpize \ + && ./configure \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && git clone --depth 1 --recurse-submodules --branch "${ZSTD_VERSION}" \ + https://github.com/kjdev/php-ext-zstd /usr/src/php-ext-zstd \ + && pushd /usr/src/php-ext-zstd \ + && phpize \ + && ./configure \ + && make -j"$(nproc)" \ + && make install \ + && popd \ + && curl -L -o /tmp/lz4.tar.gz https://github.com/kjdev/php-ext-lz4/archive/refs/heads/master.tar.gz \ + && tar -xzf /tmp/lz4.tar.gz -C /usr/src \ + && mv /usr/src/php-ext-lz4-master /usr/src/php-ext-lz4 \ + && pushd /usr/src/php-ext-lz4 \ + && phpize \ + && ./configure --with-lz4-includedir=/usr \ + && make \ + && make install \ + && popd \ + && docker-php-ext-install \ + bcmath \ + bz2 \ + exif \ + ftp \ + gd \ + intl \ + pcntl \ + pdo_mysql \ + pdo_pgsql \ + pgsql \ + soap \ + sockets \ + tidy \ + zip \ + # Temporarily building for PHP 8.0: https://github.com/Imagick/imagick/issues/358 + && git clone --depth 1 https://github.com/Imagick/imagick /usr/src/imagick \ + && pushd /usr/src/imagick \ + && phpize \ + && ./configure \ + && make \ + && make install \ + && popd \ + && mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini \ + && docker-php-ext-enable \ + amqp \ + apcu \ + igbinary \ + imagick \ + imap \ + lz4 \ + mailparse \ + memcached \ + msgpack \ + redis \ + zstd \ + && git clone --depth 1 --branch "${NGX_HTTP_GEOIP2_MODULE_VERSION}" \ + https://github.com/leev/ngx_http_geoip2_module.git \ + /usr/src/ngx_http_geoip2_module \ + && mkdir -p /usr/src/libmaxminddb \ + && curl -sSL "https://github.com/maxmind/libmaxminddb/releases/download/${LIBMAXMINDDB_VERSION}/libmaxminddb-${LIBMAXMINDDB_VERSION}.tar.gz" \ + | tar -xzf - --strip-components 1 -C /usr/src/libmaxminddb \ + && cd /usr/src/libmaxminddb \ + && ./configure \ + && make \ + && make check \ + && make install \ + && ldconfig \ + && mkdir -p /usr/src/nginx \ + && curl -sSL "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" \ + | tar -xzf - --strip-components 1 -C /usr/src/nginx \ + && cd /usr/src/nginx \ + && ./configure \ + --add-module=/usr/src/ngx_http_geoip2_module \ + --conf-path=/etc/nginx/nginx.conf \ + --error-log-path=/dev/stderr \ + --group=www-data \ + --http-client-body-temp-path=/var/cache/nginx/client_temp \ + --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ + --http-log-path=/var/log/nginx/access.log \ + --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ + --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ + --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ + --lock-path=/var/run/nginx.lock \ + --pid-path=/var/run/nginx.pid \ + --prefix=/etc/nginx \ + --sbin-path=/usr/sbin/nginx \ + --user=www-data \ + --with-file-aio \ + --with-http_mp4_module \ + --with-http_addition_module \ + --with-http_auth_request_module \ + --with-http_flv_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_random_index_module \ + --with-http_realip_module \ + --with-http_secure_link_module \ + --with-http_slice_module \ + --with-http_ssl_module \ + --with-http_stub_status_module \ + --with-http_sub_module \ + --with-http_v2_module \ + --with-stream \ + --with-stream_realip_module \ + --with-stream_ssl_module \ + --with-threads \ + && make \ + && make install \ + && mkdir -p /var/cache/nginx \ + && chown -R www-data.www-data /var/cache/nginx \ + && chsh -s /usr/sbin/nologin www-data \ + && apt-get purge -y $BUILD_DEPENDENCIES \ + && docker-php-source delete \ + && apt-get clean \ + && rm -rf \ + /tmp/* \ + /usr/src/* \ + /var/cache/debconf \ + /var/lib/apt/lists/* \ + && find /var/log -type f -print0 \ + | xargs -0 rm -f + +VOLUME /etc/nginx/conf.d + +# hadolint ignore=DL3022 +COPY --from=composer:2.10 /usr/bin/composer /usr/bin/composer +COPY app.conf /etc/supervisor/conf.d/app.conf +COPY entrypoint.sh /entrypoint.sh +COPY mime.types /etc/nginx/mime.types +COPY nginx.conf /etc/nginx/nginx.conf +COPY supervisord.conf /etc/supervisor/supervisord.conf +COPY zzz-apcu.ini /usr/local/etc/php/conf.d/zzz-apcu.ini +COPY zzz-opcache.ini /usr/local/etc/php/conf.d/zzz-opcache.ini +COPY zzz-php-fpm-tuning.conf /usr/local/etc/php-fpm.d/zzz-php-fpm-tuning.conf +COPY zzz-php-hardening.ini /usr/local/etc/php/conf.d/zzz-php-hardening.ini + +RUN chmod 0444 \ + /etc/nginx/mime.types \ + /etc/nginx/nginx.conf \ + /etc/supervisor/conf.d/app.conf \ + /etc/supervisor/supervisord.conf \ + /usr/local/etc/php-fpm.d/zzz-php-fpm-tuning.conf \ + /usr/local/etc/php/conf.d/zzz-apcu.ini \ + /usr/local/etc/php/conf.d/zzz-opcache.ini \ + /usr/local/etc/php/conf.d/zzz-php-hardening.ini \ + /usr/local/etc/php/php.ini + +# +# Run +# +FROM foundation AS run + +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION=8.5.10 + +LABEL org.label-schema.build-date="$BUILD_DATE" \ + org.label-schema.name="php-lol" \ + org.label-schema.schema-version="1.0" \ + org.label-schema.url="https://github.com/bdossantos/dockerfiles" \ + org.label-schema.usage="https://github.com/bdossantos/dockerfiles" \ + org.label-schema.vcs-ref="$VCS_REF" \ + org.label-schema.vcs-url="https://github.com/bdossantos/dockerfiles" \ + org.label-schema.vendor="PHP" \ + org.label-schema.version="$VERSION" \ + org.opencontainers.image.created="$BUILD_DATE" \ + org.opencontainers.image.documentation="https://github.com/bdossantos/dockerfiles" \ + org.opencontainers.image.revision="$VCS_REF" \ + org.opencontainers.image.source="https://github.com/bdossantos/dockerfiles" \ + org.opencontainers.image.title="php-lol" \ + org.opencontainers.image.url="https://github.com/bdossantos/dockerfiles" \ + org.opencontainers.image.vendor="PHP" \ + org.opencontainers.image.version="$VERSION" + +WORKDIR /usr/src/app + +EXPOSE 80/tcp 443/tcp + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]