From e1852c789e852cfa488db496b654ae82e7fc8e0f Mon Sep 17 00:00:00 2001 From: kumaraksh1 <112485097+kumaraksh1@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:53:35 +0530 Subject: [PATCH] Add Support for PHP|8.3 (#2375) * Add support for PHP|8.2 * Add support for PHP|8.3 * typo in version * fixing gpg keys * version fix * fix duplicate buster file issue * fix installPrereqs issue * Add support for PHP|8.3 * nit fix * updating base runtime tag * update sqlsrv * update 8.3.3 sha * Remove imagick from php|8.3 * remove imagick from PHP|8.3 * PHP|8.3.3 update base tag * Add bookworm support for PHP|8.3.3 * add bookworm for php|8.3.3 * adding common base dockerfile for bookworm * add 8.3 bookworm job * update service connection * update debian repo url * test|8.3 something * update ms packages repo * update packages * test packages php|8.3 * update 83 bookworm * rebase php|8.3 bookworm * update release template for a temporary run * temp run * Generate php base images * Update base tag | PHP|8.3.3 * Update base tag | Php-fpm|8.3.3 * test cases | php | 8.3 * update tests | php | 8.3 * tests | php | 8.3 * test cases | php|8.3 * php | 8.3 tests * test cases | php | 8.3.3 * Run PHP|8.3 Tests * php|tests | 8.3.3 * php|8.3.3 tests * add tests | php | 8.3.3 * update php|8.3.3 to 8.3.4 * update version | php | 8.3.4 * update version 8.3.3 to 8.3.4 for php * update keys for php|8.3.4 * PHP|8.3.4 | Update Base Tag * Version updates | php | 8.3.4 * address comments | php|8.3.4 * address comments | php|8.3.4 * update ltsVersions dockerfile | php|8.3 * php|8.3, ltsDockerfile * php composer | php|8.3.4 --------- Co-authored-by: root --- build/__phpVersions.sh | 9 +- build/buildRunTimeImages.sh | 3 + build/constants.yaml | 9 +- doc/supportedPlatformVersions.md | 5 +- .../build/Dockerfiles/ltsVersions.Dockerfile | 2 +- .../Dockerfiles/ltsVersions.buster.Dockerfile | 4 +- images/build/php/8.3/Dockerfile | 3 + .../php-fpm/8.3/8.3.bookworm.Dockerfile | 245 +++++++++++++++++ .../php-fpm/8.3/8.3.bullseye.Dockerfile | 250 +++++++++++++++++ .../runtime/php-fpm/8.3/8.3.buster.Dockerfile | 250 +++++++++++++++++ .../php-fpm/8.3/base.bullseye.Dockerfile | 137 +++++++++ .../runtime/php-fpm/8.3/docker-php-entrypoint | 9 + .../php-fpm/8.3/docker-php-ext-configure | 69 +++++ .../runtime/php-fpm/8.3/docker-php-ext-enable | 114 ++++++++ .../php-fpm/8.3/docker-php-ext-install | 122 ++++++++ images/runtime/php-fpm/8.3/docker-php-source | 34 +++ images/runtime/php-fpm/8.3/tag.txt | 1 + images/runtime/php-fpm/__versions.sh | 6 +- .../runtime/php-fpm/template.base.Dockerfile | 13 +- .../runtime/php/8.3/8.3.bookworm.Dockerfile | 260 ++++++++++++++++++ .../runtime/php/8.3/8.3.bullseye.Dockerfile | 260 ++++++++++++++++++ images/runtime/php/8.3/8.3.buster.Dockerfile | 260 ++++++++++++++++++ images/runtime/php/8.3/apache2-foreground | 40 +++ images/runtime/php/8.3/docker-php-entrypoint | 9 + .../runtime/php/8.3/docker-php-ext-configure | 69 +++++ images/runtime/php/8.3/docker-php-ext-enable | 114 ++++++++ images/runtime/php/8.3/docker-php-ext-install | 122 ++++++++ images/runtime/php/8.3/docker-php-source | 34 +++ images/runtime/php/__versions.sh | 6 +- images/runtime/php/template.base.Dockerfile | 11 +- platforms/php/prereqs/installPrereqs.sh | 4 + .../php/versions/bookworm/versionsToBuild.txt | 2 + .../php/versions/bullseye/versionsToBuild.txt | 3 +- .../php/versions/buster/versionsToBuild.txt | 3 +- src/BuildScriptGenerator/PhpVersions.cs | 13 +- .../DefaultDockerfileGeneratorTest.cs | 2 + .../Php/PhpDynamicInstallationTest.cs | 20 ++ .../Php/PhpSampleAppsTest.cs | 2 - .../Php/PhpDynamicInstallationTest.cs | 21 ++ .../Oryx.Integration.Tests/Php/PhpExifTest.cs | 10 + tests/Oryx.Integration.Tests/Php/PhpGdTest.cs | 10 + .../Php-fpm/PhpFpmImageTest.cs | 162 +++++++++++ .../Php/PhpImageTest.cs | 173 ++++++++++++ vsts/pipelines/baseImages/php-fpm.yml | 16 +- vsts/pipelines/baseImages/php.yml | 14 +- vsts/pipelines/nightly.yml | 21 +- vsts/pipelines/templates/_buildTemplate.yml | 7 + .../_phpIntegrationJobTemplate.yml | 10 + vsts/pipelines/validation.yml | 21 +- vsts/scripts/tagBaseImagesForRelease.sh | 2 + 50 files changed, 2926 insertions(+), 60 deletions(-) create mode 100644 images/build/php/8.3/Dockerfile create mode 100644 images/runtime/php-fpm/8.3/8.3.bookworm.Dockerfile create mode 100644 images/runtime/php-fpm/8.3/8.3.bullseye.Dockerfile create mode 100644 images/runtime/php-fpm/8.3/8.3.buster.Dockerfile create mode 100644 images/runtime/php-fpm/8.3/base.bullseye.Dockerfile create mode 100755 images/runtime/php-fpm/8.3/docker-php-entrypoint create mode 100755 images/runtime/php-fpm/8.3/docker-php-ext-configure create mode 100755 images/runtime/php-fpm/8.3/docker-php-ext-enable create mode 100755 images/runtime/php-fpm/8.3/docker-php-ext-install create mode 100755 images/runtime/php-fpm/8.3/docker-php-source create mode 100644 images/runtime/php-fpm/8.3/tag.txt create mode 100644 images/runtime/php/8.3/8.3.bookworm.Dockerfile create mode 100644 images/runtime/php/8.3/8.3.bullseye.Dockerfile create mode 100644 images/runtime/php/8.3/8.3.buster.Dockerfile create mode 100755 images/runtime/php/8.3/apache2-foreground create mode 100755 images/runtime/php/8.3/docker-php-entrypoint create mode 100755 images/runtime/php/8.3/docker-php-ext-configure create mode 100755 images/runtime/php/8.3/docker-php-ext-enable create mode 100755 images/runtime/php/8.3/docker-php-ext-install create mode 100755 images/runtime/php/8.3/docker-php-source diff --git a/build/__phpVersions.sh b/build/__phpVersions.sh index 6c6a6fcb72..536f446864 100644 --- a/build/__phpVersions.sh +++ b/build/__phpVersions.sh @@ -1,8 +1,8 @@ # This file was auto-generated from 'constants.yaml'. Changes may be overridden. -PHP_RUNTIME_BASE_TAG='20240222.2' -PHP_FPM_RUNTIME_BASE_TAG='20240222.2' -COMPOSER_DEFAULT_VERSION='2.0.8' +PHP_RUNTIME_BASE_TAG='20240318.5' +PHP_FPM_RUNTIME_BASE_TAG='20240318.4' +COMPOSER_DEFAULT_VERSION='2.6.2' COMPOSER_SETUP_SHA384='e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02' COMPOSER1_9_VERSION='1.9.3' COMPOSER1_10_VERSION='1.10.19' @@ -12,6 +12,9 @@ COMPOSER2_3_VERSION='2.3.10' COMPOSER2_4_VERSION='2.4.4' COMPOSER2_5_VERSION='2.5.8' COMPOSER2_6_VERSION='2.6.2' +PHP83_VERSION='8.3.4' +PHP83_KEYS='1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA' +PHP83_TAR_SHA256='39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63' PHP82_VERSION='8.2.16' PHP82_KEYS='1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544' PHP82_TAR_SHA256='28cdc995b7d5421711c7044294885fcde4390c9f67504a994b4cf9bc1b5cc593' diff --git a/build/buildRunTimeImages.sh b/build/buildRunTimeImages.sh index e3437186b1..3145e133fa 100755 --- a/build/buildRunTimeImages.sh +++ b/build/buildRunTimeImages.sh @@ -89,6 +89,9 @@ function getRuntimeTagVersion() elif [ "$PLATFORM_NAME" == "php" ] then case $PLATFORM_VERSION in + 8.3) + FULL_RUNTIME_TAG_VERSION=$PHP83_VERSION + ;; 8.2) FULL_RUNTIME_TAG_VERSION=$PHP82_VERSION ;; diff --git a/build/constants.yaml b/build/constants.yaml index bae3b591b5..06541147fe 100644 --- a/build/constants.yaml +++ b/build/constants.yaml @@ -185,9 +185,9 @@ file-name-prefix: __ - name: php-versions constants: - php-runtime-base-tag: 20240222.2 - php-fpm-runtime-base-tag: 20240222.2 - composer-default-version: 2.0.8 + php-runtime-base-tag: 20240318.5 + php-fpm-runtime-base-tag: 20240318.4 + composer-default-version: 2.6.2 composer-setup-sha384: e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02 composer1-9-version: 1.9.3 composer1-10-version: 1.10.19 @@ -197,6 +197,9 @@ composer2-4-version: 2.4.4 composer2-5-version: 2.5.8 composer2-6-version: 2.6.2 + php83-version: 8.3.4 + php83-keys: 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA + php83-tar-sha256: 39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63 php82-version: 8.2.16 php82-keys: 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544 php82-tar-sha256: 28cdc995b7d5421711c7044294885fcde4390c9f67504a994b4cf9bc1b5cc593 diff --git a/doc/supportedPlatformVersions.md b/doc/supportedPlatformVersions.md index 7506425a29..55aea30ec6 100644 --- a/doc/supportedPlatformVersions.md +++ b/doc/supportedPlatformVersions.md @@ -412,6 +412,7 @@ - 8.0.100 - 8.0.101 + ## golang ### bullseye @@ -1012,9 +1013,7 @@ ### bookworm -- 8.1.22 -- 8.2.9 -- 8.2.16 +- 8.3.4 ### bullseye diff --git a/images/build/Dockerfiles/ltsVersions.Dockerfile b/images/build/Dockerfiles/ltsVersions.Dockerfile index 3e9cab9789..fb27a1375e 100644 --- a/images/build/Dockerfiles/ltsVersions.Dockerfile +++ b/images/build/Dockerfiles/ltsVersions.Dockerfile @@ -196,7 +196,7 @@ RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \ && ln -s 7.3 7 \ && ln -s 7 lts \ && cd /opt/php-composer \ - && ln -sfn 2.0.8 stable \ + && ln -sfn 2.6.2 stable \ && ln -sfn /opt/php-composer/stable/composer.phar /opt/php-composer/composer.phar \ && apt-get update \ && apt-get install -y --no-install-recommends \ diff --git a/images/build/Dockerfiles/ltsVersions.buster.Dockerfile b/images/build/Dockerfiles/ltsVersions.buster.Dockerfile index 5893be1e38..68e2e9f4b1 100644 --- a/images/build/Dockerfiles/ltsVersions.buster.Dockerfile +++ b/images/build/Dockerfiles/ltsVersions.buster.Dockerfile @@ -177,12 +177,12 @@ RUN --mount=type=secret,id=oryx_sdk_storage_account_access_token \ # Copy PHP versions && . $buildDir/__phpVersions.sh \ && $imagesDir/installPlatform.sh php $PHP80_VERSION \ - && $imagesDir/installPlatform.sh php-composer $COMPOSER1_10_VERSION \ + && $imagesDir/installPlatform.sh php-composer $COMPOSER2_6_VERSION \ && cd /opt/php \ && ln -s 8.0 8 \ && ln -s 8 lts \ && cd /opt/php-composer \ - && ln -sfn 2.0.8 stable \ + && ln -sfn 2.6.2 stable \ && ln -sfn /opt/php-composer/stable/composer.phar /opt/php-composer/composer.phar \ && apt-get update \ && apt-get install -y --no-install-recommends \ diff --git a/images/build/php/8.3/Dockerfile b/images/build/php/8.3/Dockerfile new file mode 100644 index 0000000000..c50211d214 --- /dev/null +++ b/images/build/php/8.3/Dockerfile @@ -0,0 +1,3 @@ +# Build PHP 8.3 +FROM oryxdevmcr.azurecr.io/private/oryx/php-build-prereqs AS php83-build +RUN set -eux && . /php/__phpVersions.sh && PHP_VERSION=$PHP83_VERSION GPG_KEYS=$PHP83_KEYS PHP_SHA256=$PHP83_TAR_SHA256 /php/build.sh \ No newline at end of file diff --git a/images/runtime/php-fpm/8.3/8.3.bookworm.Dockerfile b/images/runtime/php-fpm/8.3/8.3.bookworm.Dockerfile new file mode 100644 index 0000000000..7a955e5911 --- /dev/null +++ b/images/runtime/php-fpm/8.3/8.3.bookworm.Dockerfile @@ -0,0 +1,245 @@ +ARG DEBIAN_FLAVOR +# From https://github.com/docker-library/php.git +FROM oryxdevmcr.azurecr.io/private/oryx/php-fpm-run-base-${DEBIAN_FLAVOR} +ARG IMAGES_DIR=/tmp/oryx/images + +# Install the Microsoft SQL Server PDO driver on supported versions only. +# - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac +# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + gnupg2 \ + apt-transport-https \ + && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && apt-get update \ + && ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 777 /var/www/html + +#### +ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4 + +ENV PHP_VERSION 8.3.4 +ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror" +ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5="" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg dirmngr; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + ${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libonig-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + #which docker-php-source; \ + awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \ + cat /usr/local/bin/docker-php-source_new; \ + chmod +x /usr/local/bin/docker-php-source_new ; \ + docker-php-source_new extract; \ + ls -l /usr/src/; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors intead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ +# bundled pcre does not support JIT on s390x +# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source_new delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-php-ext-* +RUN chmod +x /usr/local/bin/docker-php-entrypoint + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +#### +WORKDIR /var/www/html + +RUN set -eux; \ + cd /usr/local/etc; \ + if [ -d php-fpm.d ]; then \ + # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" + sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ + cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + else \ + # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency + mkdir php-fpm.d; \ + cp php-fpm.conf.default php-fpm.d/www.conf; \ + { \ + echo '[global]'; \ + echo 'include=etc/php-fpm.d/*.conf'; \ + } | tee php-fpm.conf; \ + fi; \ + { \ + echo '[global]'; \ + echo 'error_log = /proc/self/fd/2'; \ + echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ + echo; \ + echo '[www]'; \ + echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo 'access.log = /proc/self/fd/2'; \ + echo; \ + echo 'clear_env = no'; \ + echo; \ + echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ + echo 'catch_workers_output = yes'; \ + echo 'decorate_workers_output = no'; \ + } | tee php-fpm.d/docker.conf; \ + { \ + echo '[global]'; \ + echo 'daemonize = no'; \ + echo; \ + echo '[www]'; \ + echo 'listen = 9000'; \ + } | tee php-fpm.d/zz-docker.conf + +RUN rm -rf /var/lib/apt/lists/* + +# Override stop signal to stop process gracefully +# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 +STOPSIGNAL SIGQUIT + +EXPOSE 9000 +CMD ["php-fpm"] +#### diff --git a/images/runtime/php-fpm/8.3/8.3.bullseye.Dockerfile b/images/runtime/php-fpm/8.3/8.3.bullseye.Dockerfile new file mode 100644 index 0000000000..6c02fec320 --- /dev/null +++ b/images/runtime/php-fpm/8.3/8.3.bullseye.Dockerfile @@ -0,0 +1,250 @@ +ARG DEBIAN_FLAVOR +# From https://github.com/docker-library/php.git +FROM oryxdevmcr.azurecr.io/private/oryx/php-fpm-run-base-${DEBIAN_FLAVOR} +ARG IMAGES_DIR=/tmp/oryx/images + +# do NOT merge this content with above line because the +# above line is shared across all php images +# Install the Microsoft SQL Server PDO driver on supported versions only. +# - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac +# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + gnupg2 \ + apt-transport-https \ + && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && apt-get update \ + && ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 777 /var/www/html + +#### +ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4 + +ENV PHP_VERSION 8.3.4 +ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror" +ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5="" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg dirmngr; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + ${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libonig-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + #which docker-php-source; \ + awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \ + cat /usr/local/bin/docker-php-source_new; \ + chmod +x /usr/local/bin/docker-php-source_new ; \ + docker-php-source_new extract; \ + ls -l /usr/src/; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors intead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ +# bundled pcre does not support JIT on s390x +# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source_new delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-php-ext-* +RUN chmod +x /usr/local/bin/docker-php-entrypoint + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +#### +WORKDIR /var/www/html + +RUN set -eux; \ + cd /usr/local/etc; \ + if [ -d php-fpm.d ]; then \ + # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" + sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ + cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + else \ + # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency + mkdir php-fpm.d; \ + cp php-fpm.conf.default php-fpm.d/www.conf; \ + { \ + echo '[global]'; \ + echo 'include=etc/php-fpm.d/*.conf'; \ + } | tee php-fpm.conf; \ + fi; \ + { \ + echo '[global]'; \ + echo 'error_log = /proc/self/fd/2'; \ + echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ + echo; \ + echo '[www]'; \ + echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo 'access.log = /proc/self/fd/2'; \ + echo; \ + echo 'clear_env = no'; \ + echo; \ + echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ + echo 'catch_workers_output = yes'; \ + echo 'decorate_workers_output = no'; \ + } | tee php-fpm.d/docker.conf; \ + { \ + echo '[global]'; \ + echo 'daemonize = no'; \ + echo; \ + echo '[www]'; \ + echo 'listen = 9000'; \ + } | tee php-fpm.d/zz-docker.conf + +RUN rm -rf /var/lib/apt/lists/* + +# Override stop signal to stop process gracefully +# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 +STOPSIGNAL SIGQUIT + +EXPOSE 9000 +CMD ["php-fpm"] +#### diff --git a/images/runtime/php-fpm/8.3/8.3.buster.Dockerfile b/images/runtime/php-fpm/8.3/8.3.buster.Dockerfile new file mode 100644 index 0000000000..dc8c10a53c --- /dev/null +++ b/images/runtime/php-fpm/8.3/8.3.buster.Dockerfile @@ -0,0 +1,250 @@ +ARG DEBIAN_FLAVOR +# From https://github.com/docker-library/php.git +FROM oryxdevmcr.azurecr.io/private/oryx/php-fpm-run-base-${DEBIAN_FLAVOR} +ARG IMAGES_DIR=/tmp/oryx/images + +# do NOT merge this content with above line because the +# above line is shared across all php images +# Install the Microsoft SQL Server PDO driver on supported versions only. +# - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac +# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + gnupg2 \ + apt-transport-https \ + && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && apt-get update \ + && ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 777 /var/www/html + +#### +ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi ac_cv_func_mmap=no +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4 + +ENV PHP_VERSION 8.3.4 +ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror" +ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5="" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg dirmngr; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + ${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libonig-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + #which docker-php-source; \ + awk '{ sub("\r$", ""); print }' /usr/local/bin/docker-php-source > /usr/local/bin/docker-php-source_new; \ + cat /usr/local/bin/docker-php-source_new; \ + chmod +x /usr/local/bin/docker-php-source_new ; \ + docker-php-source_new extract; \ + ls -l /usr/src/; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors intead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ +# bundled pcre does not support JIT on s390x +# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source_new delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-php-ext-* +RUN chmod +x /usr/local/bin/docker-php-entrypoint + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium + +ENTRYPOINT ["docker-php-entrypoint"] +#### +WORKDIR /var/www/html + +RUN set -eux; \ + cd /usr/local/etc; \ + if [ -d php-fpm.d ]; then \ + # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" + sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ + cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + else \ + # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency + mkdir php-fpm.d; \ + cp php-fpm.conf.default php-fpm.d/www.conf; \ + { \ + echo '[global]'; \ + echo 'include=etc/php-fpm.d/*.conf'; \ + } | tee php-fpm.conf; \ + fi; \ + { \ + echo '[global]'; \ + echo 'error_log = /proc/self/fd/2'; \ + echo; echo '; https://github.com/docker-library/php/pull/725#issuecomment-443540114'; echo 'log_limit = 8192'; \ + echo; \ + echo '[www]'; \ + echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo 'access.log = /proc/self/fd/2'; \ + echo; \ + echo 'clear_env = no'; \ + echo; \ + echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ + echo 'catch_workers_output = yes'; \ + echo 'decorate_workers_output = no'; \ + } | tee php-fpm.d/docker.conf; \ + { \ + echo '[global]'; \ + echo 'daemonize = no'; \ + echo; \ + echo '[www]'; \ + echo 'listen = 9000'; \ + } | tee php-fpm.d/zz-docker.conf + +RUN rm -rf /var/lib/apt/lists/* + +# Override stop signal to stop process gracefully +# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163 +STOPSIGNAL SIGQUIT + +EXPOSE 9000 +CMD ["php-fpm"] +#### diff --git a/images/runtime/php-fpm/8.3/base.bullseye.Dockerfile b/images/runtime/php-fpm/8.3/base.bullseye.Dockerfile new file mode 100644 index 0000000000..0e3dd665b2 --- /dev/null +++ b/images/runtime/php-fpm/8.3/base.bullseye.Dockerfile @@ -0,0 +1,137 @@ +FROM oryxdevmcr.azurecr.io/private/oryx/php-fpm-8.3-bullseye +SHELL ["/bin/bash", "-c"] +ENV PHP_VERSION 8.3.4 + +# An environment variable for oryx run-script to know the origin of php image so that +# start-up command can be determined while creating run script +ENV PHP_ORIGIN php-fpm +ENV NGINX_RUN_USER www-data +# Edit the default DocumentRoot setting +ENV NGINX_DOCUMENT_ROOT /home/site/wwwroot +# Install NGINX latest stable version using APT Method with Nginx Repository instead of distribution-provided one: +# - https://www.linuxcapable.com/how-to-install-latest-nginx-mainline-or-stable-on-debian-11/ +RUN apt-get update +RUN apt install curl nano -y +RUN curl -sSL https://packages.sury.org/nginx/README.txt | bash -x +RUN apt-get update +RUN yes '' | apt-get install nginx-core nginx-common nginx nginx-full -y +RUN ls -l /etc/nginx +COPY images/runtime/php-fpm/nginx_conf/default.conf /etc/nginx/sites-available/default +COPY images/runtime/php-fpm/nginx_conf/default.conf /etc/nginx/sites-enabled/default +RUN sed -ri -e 's!worker_connections 768!worker_connections 10068!g' /etc/nginx/nginx.conf +RUN sed -ri -e 's!# multi_accept on!multi_accept on!g' /etc/nginx/nginx.conf +RUN ls -l /etc/nginx +RUN nginx -t +# Edit the default port setting +ENV NGINX_PORT 8080 + +# Install common PHP extensions +# TEMPORARY: Holding odbc related packages from upgrading. +RUN apt-mark hold msodbcsql18 odbcinst1debian2 odbcinst unixodbc unixodbc-dev \ + && apt-get update \ + && apt-get upgrade -y \ + && ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \ + && ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so \ + && ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h + +RUN set -eux; \ + if [[ $PHP_VERSION == 7.4.* || $PHP_VERSION == 8.0.* || $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; then \ + apt-get update \ + && apt-get upgrade -y \ + && apt-get install -y --no-install-recommends apache2-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && PHP_OPENSSL=yes docker-php-ext-configure imap --with-kerberos --with-imap-ssl ; \ + else \ + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ + && docker-php-ext-configure imap --with-kerberos --with-imap-ssl ; \ + fi + +RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \ + && docker-php-ext-install gd \ + mysqli \ + opcache \ + pdo \ + pdo_mysql \ + pdo_pgsql \ + pgsql \ + ldap \ + intl \ + gmp \ + zip \ + bcmath \ + mbstring \ + pcntl \ + calendar \ + exif \ + gettext \ + imap \ + tidy \ + shmop \ + soap \ + sockets \ + sysvmsg \ + sysvsem \ + sysvshm \ + pdo_odbc \ +# deprecated from 7.4, so should be avoided in general template for all php versions +# xmlrpc \ + xsl +RUN pecl install redis && docker-php-ext-enable redis +# https://github.com/Imagick/imagick/issues/331 +RUN pecl install imagick && docker-php-ext-enable imagick + +# deprecated from 5.*, so should be avoided +RUN set -eux; \ + if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \ + pecl install mongodb && docker-php-ext-enable mongodb; \ + fi + +# https://github.com/microsoft/mysqlnd_azure, Supports 7.2*, 7.3* and 7.4* +RUN set -eux; \ + if [[ $PHP_VERSION == 7.2.* || $PHP_VERSION == 7.3.* || $PHP_VERSION == 7.4.* ]]; then \ + echo "pecl/mysqlnd_azure requires PHP (version >= 7.2.*, version <= 7.99.99)"; \ + pecl install mysqlnd_azure \ + && docker-php-ext-enable mysqlnd_azure; \ + fi + +# Install the Microsoft SQL Server PDO driver on supported versions only. +# - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac +# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN set -eux; \ + if [[ $PHP_VERSION == 8.* ]]; then \ + pecl install sqlsrv pdo_sqlsrv \ + && echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini \ + && echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-sqlsrv.ini; \ + fi + +RUN { \ + echo 'opcache.memory_consumption=128'; \ + echo 'opcache.interned_strings_buffer=8'; \ + echo 'opcache.max_accelerated_files=4000'; \ + echo 'opcache.revalidate_freq=60'; \ + echo 'opcache.fast_shutdown=1'; \ + echo 'opcache.enable_cli=1'; \ + } > /usr/local/etc/php/conf.d/opcache-recommended.ini + +# NOTE: zend_extension=opcache is already configured via docker-php-ext-install, above +RUN { \ + echo 'error_log=/var/log/apache2/php-error.log'; \ + echo 'display_errors=Off'; \ + echo 'log_errors=On'; \ + echo 'display_startup_errors=Off'; \ + echo 'date.timezone=UTC'; \ + } > /usr/local/etc/php/conf.d/php.ini + +RUN set -x \ + && docker-php-source extract \ + && cd /usr/src/php/ext/odbc \ + && phpize \ + && sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure \ + && chmod +x ./configure \ + && ./configure --with-unixODBC=shared,/usr \ + && docker-php-ext-install odbc \ + && rm -rf /var/lib/apt/lists/* + +ENV LANG="C.UTF-8" \ + LANGUAGE="C.UTF-8" \ + LC_ALL="C.UTF-8" \ No newline at end of file diff --git a/images/runtime/php-fpm/8.3/docker-php-entrypoint b/images/runtime/php-fpm/8.3/docker-php-entrypoint new file mode 100755 index 0000000000..86343d8038 --- /dev/null +++ b/images/runtime/php-fpm/8.3/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- php-fpm "$@" +fi + +exec "$@" diff --git a/images/runtime/php-fpm/8.3/docker-php-ext-configure b/images/runtime/php-fpm/8.3/docker-php-ext-configure new file mode 100755 index 0000000000..34fc1337d5 --- /dev/null +++ b/images/runtime/php-fpm/8.3/docker-php-ext-configure @@ -0,0 +1,69 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [configure flags]" + echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; then + usage >&2 + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +cd "$ext" +phpize +./configure --enable-option-checking=fatal "$@" diff --git a/images/runtime/php-fpm/8.3/docker-php-ext-enable b/images/runtime/php-fpm/8.3/docker-php-ext-enable new file mode 100755 index 0000000000..3d079d2160 --- /dev/null +++ b/images/runtime/php-fpm/8.3/docker-php-ext-enable @@ -0,0 +1,114 @@ +#!/bin/sh +set -e + +extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" +cd "$extDir" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + find -maxdepth 1 \ + -type f \ + -name '*.so' \ + -exec basename '{}' ';' \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: '$module' does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + absModule="$(readlink -f "$module")" + line="zend_extension=$absModule" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi diff --git a/images/runtime/php-fpm/8.3/docker-php-ext-install b/images/runtime/php-fpm/8.3/docker-php-ext-install new file mode 100755 index 0000000000..1afa66273b --- /dev/null +++ b/images/runtime/php-fpm/8.3/docker-php-ext-install @@ -0,0 +1,122 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/images/runtime/php-fpm/8.3/docker-php-source b/images/runtime/php-fpm/8.3/docker-php-source new file mode 100755 index 0000000000..720d4ad153 --- /dev/null +++ b/images/runtime/php-fpm/8.3/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac \ No newline at end of file diff --git a/images/runtime/php-fpm/8.3/tag.txt b/images/runtime/php-fpm/8.3/tag.txt new file mode 100644 index 0000000000..18d0adf8c9 --- /dev/null +++ b/images/runtime/php-fpm/8.3/tag.txt @@ -0,0 +1 @@ +php:8.3-fpm \ No newline at end of file diff --git a/images/runtime/php-fpm/__versions.sh b/images/runtime/php-fpm/__versions.sh index 0d3ec01222..09ec871dae 100644 --- a/images/runtime/php-fpm/__versions.sh +++ b/images/runtime/php-fpm/__versions.sh @@ -2,6 +2,6 @@ declare -r __DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" source "$__DIR/../../../build/__phpVersions.sh" -declare -r VERSION_ARRAY_BOOKWORM=() -declare -r VERSION_ARRAY_BULLSEYE=($PHP74_VERSION $PHP80_VERSION $PHP81_VERSION $PHP82_VERSION) -declare -r VERSION_ARRAY_BUSTER=($PHP74_VERSION $PHP80_VERSION $PHP81_VERSION $PHP82_VERSION) +declare -r VERSION_ARRAY_BOOKWORM=($PHP83_VERSION) +declare -r VERSION_ARRAY_BULLSEYE=($PHP74_VERSION $PHP80_VERSION $PHP81_VERSION $PHP82_VERSION $PHP83_VERSION) +declare -r VERSION_ARRAY_BUSTER=($PHP74_VERSION $PHP80_VERSION $PHP81_VERSION $PHP82_VERSION $PHP83_VERSION) \ No newline at end of file diff --git a/images/runtime/php-fpm/template.base.Dockerfile b/images/runtime/php-fpm/template.base.Dockerfile index 5c042b39e4..0c0cc2c374 100644 --- a/images/runtime/php-fpm/template.base.Dockerfile +++ b/images/runtime/php-fpm/template.base.Dockerfile @@ -35,7 +35,7 @@ RUN apt-mark hold msodbcsql18 odbcinst1debian2 odbcinst unixodbc unixodbc-dev \ && ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h RUN set -eux; \ - if [[ $PHP_VERSION == 7.4.* || $PHP_VERSION == 8.0.* || $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* ]]; then \ + if [[ $PHP_VERSION == 7.4.* || $PHP_VERSION == 8.0.* || $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; then \ apt-get update \ && apt-get upgrade -y \ && apt-get install -y --no-install-recommends apache2-dev \ @@ -77,9 +77,14 @@ RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \ # xmlrpc \ xsl RUN pecl install redis && docker-php-ext-enable redis -# https://github.com/Imagick/imagick/issues/331 -RUN pecl install imagick && docker-php-ext-enable imagick +# https://github.com/Imagick/imagick/issues/331 +# https://github.com/ihneo/php/pull/24/files +RUN set -eux; \ + if [[ $PHP_VERSION != 8.3.* ]]; then \ + pecl install imagick && docker-php-ext-enable imagick; \ + fi + # deprecated from 5.*, so should be avoided RUN set -eux; \ if [[ $PHP_VERSION != 5.* && $PHP_VERSION != 7.0.* ]]; then \ @@ -107,7 +112,7 @@ RUN set -eux; \ # Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0) RUN set -eux; \ - if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* ]]; then \ + if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; then \ pecl install sqlsrv pdo_sqlsrv \ && echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini \ && echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-sqlsrv.ini; \ diff --git a/images/runtime/php/8.3/8.3.bookworm.Dockerfile b/images/runtime/php/8.3/8.3.bookworm.Dockerfile new file mode 100644 index 0000000000..6debab7889 --- /dev/null +++ b/images/runtime/php/8.3/8.3.bookworm.Dockerfile @@ -0,0 +1,260 @@ +ARG DEBIAN_FLAVOR +# From https://github.com/docker-library/php.git +FROM oryxdevmcr.azurecr.io/private/oryx/php-run-base-${DEBIAN_FLAVOR} +ARG IMAGES_DIR=/tmp/oryx/images + +# Install the Microsoft SQL Server PDO driver on supported versions only. +# - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac +# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + gnupg2 \ + apt-transport-https \ + && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && apt-get update \ + && ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 777 /var/www/html +#### +ENV APACHE_CONFDIR /etc/apache2 +ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends apache2; \ + rm -rf /var/lib/apt/lists/*; \ + \ +# generically convert lines like +# export APACHE_RUN_USER=www-data +# into +# : ${APACHE_RUN_USER:=www-data} +# export APACHE_RUN_USER +# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") + sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \ + \ +# setup directories and permissions + . "$APACHE_ENVVARS"; \ + for dir in \ + "$APACHE_LOCK_DIR" \ + "$APACHE_RUN_DIR" \ + "$APACHE_LOG_DIR" \ + ; do \ + rm -rvf "$dir"; \ + mkdir -p "$dir"; \ + chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + chmod 777 "$dir"; \ + done; \ + \ +# delete the "index.html" that installing Apache drops in here + rm -rvf /var/www/html/*; \ + \ +# logs should go to stdout / stderr + ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \ + chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR" + +# Apache + PHP requires preforking Apache for best results +RUN a2dismod mpm_event && a2enmod mpm_prefork + +# PHP files should be handled by PHP, and should be preferred over any other file type +RUN { \ + echo ''; \ + echo '\tSetHandler application/x-httpd-php'; \ + echo ''; \ + echo; \ + echo 'DirectoryIndex disabled'; \ + echo 'DirectoryIndex index.php index.html'; \ + echo; \ + echo ''; \ + echo '\tOptions -Indexes'; \ + echo '\tAllowOverride All'; \ + echo ''; \ + } | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \ + && a2enconf docker-php + +ENV PHP_EXTRA_BUILD_DEPS apache2-dev +ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4 + +ENV PHP_VERSION 8.3.4 +ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror" +ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5="" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg dirmngr; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + ${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libonig-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors intead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ +# bundled pcre does not support JIT on s390x +# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + #apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + #\ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium \ + && rm -rf /var/lib/apt/lists/* + +ENTRYPOINT ["docker-php-entrypoint"] +#### +# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop +STOPSIGNAL SIGWINCH + +COPY apache2-foreground /usr/local/bin/ +WORKDIR /var/www/html + +EXPOSE 80 +CMD ["apache2-foreground"] +#### diff --git a/images/runtime/php/8.3/8.3.bullseye.Dockerfile b/images/runtime/php/8.3/8.3.bullseye.Dockerfile new file mode 100644 index 0000000000..76b9150498 --- /dev/null +++ b/images/runtime/php/8.3/8.3.bullseye.Dockerfile @@ -0,0 +1,260 @@ +ARG DEBIAN_FLAVOR +# From https://github.com/docker-library/php.git +FROM oryxdevmcr.azurecr.io/private/oryx/php-run-base-${DEBIAN_FLAVOR} +ARG IMAGES_DIR=/tmp/oryx/images + +# Install the Microsoft SQL Server PDO driver on supported versions only. +# - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac +# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + gnupg2 \ + apt-transport-https \ + && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && apt-get update \ + && ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 777 /var/www/html +#### +ENV APACHE_CONFDIR /etc/apache2 +ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends apache2; \ + rm -rf /var/lib/apt/lists/*; \ + \ +# generically convert lines like +# export APACHE_RUN_USER=www-data +# into +# : ${APACHE_RUN_USER:=www-data} +# export APACHE_RUN_USER +# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") + sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \ + \ +# setup directories and permissions + . "$APACHE_ENVVARS"; \ + for dir in \ + "$APACHE_LOCK_DIR" \ + "$APACHE_RUN_DIR" \ + "$APACHE_LOG_DIR" \ + ; do \ + rm -rvf "$dir"; \ + mkdir -p "$dir"; \ + chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + chmod 777 "$dir"; \ + done; \ + \ +# delete the "index.html" that installing Apache drops in here + rm -rvf /var/www/html/*; \ + \ +# logs should go to stdout / stderr + ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \ + chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR" + +# Apache + PHP requires preforking Apache for best results +RUN a2dismod mpm_event && a2enmod mpm_prefork + +# PHP files should be handled by PHP, and should be preferred over any other file type +RUN { \ + echo ''; \ + echo '\tSetHandler application/x-httpd-php'; \ + echo ''; \ + echo; \ + echo 'DirectoryIndex disabled'; \ + echo 'DirectoryIndex index.php index.html'; \ + echo; \ + echo ''; \ + echo '\tOptions -Indexes'; \ + echo '\tAllowOverride All'; \ + echo ''; \ + } | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \ + && a2enconf docker-php + +ENV PHP_EXTRA_BUILD_DEPS apache2-dev +ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4 + +ENV PHP_VERSION 8.3.4 +ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror" +ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5="" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg dirmngr; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + ${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libonig-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors intead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ +# bundled pcre does not support JIT on s390x +# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium \ + && rm -rf /var/lib/apt/lists/* + +ENTRYPOINT ["docker-php-entrypoint"] +#### +# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop +STOPSIGNAL SIGWINCH + +COPY apache2-foreground /usr/local/bin/ +WORKDIR /var/www/html + +EXPOSE 80 +CMD ["apache2-foreground"] +#### diff --git a/images/runtime/php/8.3/8.3.buster.Dockerfile b/images/runtime/php/8.3/8.3.buster.Dockerfile new file mode 100644 index 0000000000..ff1e8823a4 --- /dev/null +++ b/images/runtime/php/8.3/8.3.buster.Dockerfile @@ -0,0 +1,260 @@ +ARG DEBIAN_FLAVOR +# From https://github.com/docker-library/php.git +FROM oryxdevmcr.azurecr.io/private/oryx/php-run-base-${DEBIAN_FLAVOR} +ARG IMAGES_DIR=/tmp/oryx/images + +# Install the Microsoft SQL Server PDO driver on supported versions only. +# - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac +# - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +RUN set -eux \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + gnupg2 \ + apt-transport-https \ + && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ + && curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && apt-get update \ + && ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18=18.1.2.1-1 odbcinst1debian2=2.3.7 odbcinst=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN set -eux; \ + mkdir -p "$PHP_INI_DIR/conf.d"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + [ ! -d /var/www/html ]; \ + mkdir -p /var/www/html; \ + chown www-data:www-data /var/www/html; \ + chmod 777 /var/www/html +#### +ENV APACHE_CONFDIR /etc/apache2 +ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends apache2; \ + rm -rf /var/lib/apt/lists/*; \ + \ +# generically convert lines like +# export APACHE_RUN_USER=www-data +# into +# : ${APACHE_RUN_USER:=www-data} +# export APACHE_RUN_USER +# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") + sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \ + \ +# setup directories and permissions + . "$APACHE_ENVVARS"; \ + for dir in \ + "$APACHE_LOCK_DIR" \ + "$APACHE_RUN_DIR" \ + "$APACHE_LOG_DIR" \ + ; do \ + rm -rvf "$dir"; \ + mkdir -p "$dir"; \ + chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ +# allow running as an arbitrary user (https://github.com/docker-library/php/issues/743) + chmod 777 "$dir"; \ + done; \ + \ +# delete the "index.html" that installing Apache drops in here + rm -rvf /var/www/html/*; \ + \ +# logs should go to stdout / stderr + ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \ + chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR" + +# Apache + PHP requires preforking Apache for best results +RUN a2dismod mpm_event && a2enmod mpm_prefork + +# PHP files should be handled by PHP, and should be preferred over any other file type +RUN { \ + echo ''; \ + echo '\tSetHandler application/x-httpd-php'; \ + echo ''; \ + echo; \ + echo 'DirectoryIndex disabled'; \ + echo 'DirectoryIndex index.php index.html'; \ + echo; \ + echo ''; \ + echo '\tOptions -Indexes'; \ + echo '\tAllowOverride All'; \ + echo ''; \ + } | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \ + && a2enconf docker-php + +ENV PHP_EXTRA_BUILD_DEPS apache2-dev +ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --disable-cgi ac_cv_func_mmap=no +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +# -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php) +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA C28D937575603EB4ABB725861C0779DC5C0A9DE4 + +ENV PHP_VERSION 8.3.4 +ENV PHP_URL="https://www.php.net/get/php-8.3.4.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.3.4.tar.xz.asc/from/this/mirror" +ENV PHP_SHA256="39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63" PHP_MD5="" + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg dirmngr; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + curl -fsSL -o php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + curl -fsSL -o php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + ${IMAGES_DIR}/receiveGpgKeys.sh $GPG_KEYS; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false + +COPY docker-php-source /usr/local/bin/ + +RUN set -eux; \ + \ + + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libargon2-dev \ + libcurl4-openssl-dev \ + libedit-dev \ + libonig-dev \ + libsodium-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + ${PHP_EXTRA_BUILD_DEPS:-} \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + \ + export \ + CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + ; \ + docker-php-source extract; \ + cd /usr/src/php; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ +# https://bugs.php.net/bug.php?id=74125 + if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi; \ + ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ +# make sure invalid --configure-flags are fatal errors intead of just warnings + --enable-option-checking=fatal \ + \ +# https://github.com/docker-library/php/issues/439 + --with-mhash \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ +# https://wiki.php.net/rfc/argon2_password_hash (7.2+) + --with-password-argon2 \ +# https://wiki.php.net/rfc/libsodium + --with-sodium=shared \ +# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109) + --with-pdo-sqlite=/usr \ + --with-sqlite3=/usr \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear") and will be removed in PHP 8+; see also https://github.com/docker-library/php/issues/846#issuecomment-505638494 + --with-pear \ + \ +# bundled pcre does not support JIT on s390x +# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ + --with-libdir="lib/$debMultiarch" \ + \ + ${PHP_EXTRA_CONFIGURE_ARGS:-} \ + ; \ + make -j "$(nproc)"; \ + find -type f -name '*.a' -delete; \ + make install; \ + find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; \ + make clean; \ + \ +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) + cp -v php.ini-* "$PHP_INI_DIR/"; \ + \ + cd /; \ + docker-php-source delete; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ +# update pecl channel definitions https://github.com/docker-library/php/issues/443 + pecl update-channels; \ + rm -rf /tmp/pear ~/.pearrc; \ +# smoke test + php --version + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +# sodium was built as a shared module (so that it can be replaced later if so desired), so let's enable it too (https://github.com/docker-library/php/issues/598) +RUN docker-php-ext-enable sodium \ + && rm -rf /var/lib/apt/lists/* + +ENTRYPOINT ["docker-php-entrypoint"] +#### +# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop +STOPSIGNAL SIGWINCH + +COPY apache2-foreground /usr/local/bin/ +WORKDIR /var/www/html + +EXPOSE 80 +CMD ["apache2-foreground"] +#### diff --git a/images/runtime/php/8.3/apache2-foreground b/images/runtime/php/8.3/apache2-foreground new file mode 100755 index 0000000000..5fe22e26f7 --- /dev/null +++ b/images/runtime/php/8.3/apache2-foreground @@ -0,0 +1,40 @@ +#!/bin/bash +set -e + +# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background. +# (also, when run as "apache2ctl ", it does not use "exec", which leaves an undesirable resident shell process) + +: "${APACHE_CONFDIR:=/etc/apache2}" +: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}" +if test -f "$APACHE_ENVVARS"; then + . "$APACHE_ENVVARS" +fi + +# Apache gets grumpy about PID files pre-existing +: "${APACHE_RUN_DIR:=/var/run/apache2}" +: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}" +rm -f "$APACHE_PID_FILE" + +# create missing directories +# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR) +for e in "${!APACHE_@}"; do + if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then + # handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir + # mkdir: cannot create directory '/var/lock': File exists + dir="${!e}" + while [ "$dir" != "$(dirname "$dir")" ]; do + dir="$(dirname "$dir")" + if [ -d "$dir" ]; then + break + fi + absDir="$(readlink -f "$dir" 2>/dev/null || :)" + if [ -n "$absDir" ]; then + mkdir -p "$absDir" + fi + done + + mkdir -p "${!e}" + fi +done + +exec apache2 -DFOREGROUND "$@" diff --git a/images/runtime/php/8.3/docker-php-entrypoint b/images/runtime/php/8.3/docker-php-entrypoint new file mode 100755 index 0000000000..3d36d5e8cf --- /dev/null +++ b/images/runtime/php/8.3/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" diff --git a/images/runtime/php/8.3/docker-php-ext-configure b/images/runtime/php/8.3/docker-php-ext-configure new file mode 100755 index 0000000000..9e949e1e13 --- /dev/null +++ b/images/runtime/php/8.3/docker-php-ext-configure @@ -0,0 +1,69 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [configure flags]" + echo " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; then + usage >&2 + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +cd "$ext" +phpize +./configure "$@" diff --git a/images/runtime/php/8.3/docker-php-ext-enable b/images/runtime/php/8.3/docker-php-ext-enable new file mode 100755 index 0000000000..3d079d2160 --- /dev/null +++ b/images/runtime/php/8.3/docker-php-ext-enable @@ -0,0 +1,114 @@ +#!/bin/sh +set -e + +extDir="$(php -d 'display_errors=stderr' -r 'echo ini_get("extension_dir");')" +cd "$extDir" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + find -maxdepth 1 \ + -type f \ + -name '*.so' \ + -exec basename '{}' ';' \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: '$module' does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if readelf --wide --syms "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + absModule="$(readlink -f "$module")" + line="zend_extension=$absModule" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -d 'display_errors=stderr' -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="$PHP_INI_DIR/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi diff --git a/images/runtime/php/8.3/docker-php-ext-install b/images/runtime/php/8.3/docker-php-ext-install new file mode 100755 index 0000000000..1afa66273b --- /dev/null +++ b/images/runtime/php/8.3/docker-php-ext-install @@ -0,0 +1,122 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + echo + echo 'Some of the above modules are already compiled into PHP; please check' + echo 'the output of "php -i" to see which modules are already loaded.' +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del --no-network $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/images/runtime/php/8.3/docker-php-source b/images/runtime/php/8.3/docker-php-source new file mode 100755 index 0000000000..9033d243de --- /dev/null +++ b/images/runtime/php/8.3/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/images/runtime/php/__versions.sh b/images/runtime/php/__versions.sh index 543399b91b..0c83c4d7f3 100644 --- a/images/runtime/php/__versions.sh +++ b/images/runtime/php/__versions.sh @@ -4,6 +4,6 @@ declare -r __DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" source "$__DIR/../../../build/__phpVersions.sh" # Please make sure that any changes to debian flavors supported here are also reflected in build/constants.yaml -declare -r VERSION_ARRAY_BOOKWORM=() -declare -r VERSION_ARRAY_BULLSEYE=($PHP74_VERSION $PHP80_VERSION $PHP81_VERSION $PHP82_VERSION) -declare -r VERSION_ARRAY_BUSTER=($PHP74_VERSION $PHP80_VERSION $PHP81_VERSION $PHP82_VERSION) +declare -r VERSION_ARRAY_BOOKWORM=($PHP83_VERSION) +declare -r VERSION_ARRAY_BULLSEYE=($PHP74_VERSION $PHP80_VERSION $PHP81_VERSION $PHP82_VERSION $PHP83_VERSION) +declare -r VERSION_ARRAY_BUSTER=($PHP74_VERSION $PHP80_VERSION $PHP81_VERSION $PHP82_VERSION $PHP83_VERSION) diff --git a/images/runtime/php/template.base.Dockerfile b/images/runtime/php/template.base.Dockerfile index 590778d877..ae15dee0ee 100644 --- a/images/runtime/php/template.base.Dockerfile +++ b/images/runtime/php/template.base.Dockerfile @@ -36,7 +36,7 @@ RUN apt-mark hold msodbcsql18 odbcinst1debian2 odbcinst unixodbc unixodbc-dev \ && ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h RUN set -eux; \ - if [[ $PHP_VERSION == 7.4.* || $PHP_VERSION == 8.0.* || $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* ]]; then \ + if [[ $PHP_VERSION == 7.4.* || $PHP_VERSION == 8.0.* || $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; then \ apt-get update \ && apt-get upgrade -y \ && apt-get install -y --no-install-recommends apache2-dev \ @@ -85,7 +85,11 @@ RUN set -eux; \ fi # https://github.com/Imagick/imagick/issues/331 -RUN pecl install imagick && docker-php-ext-enable imagick +# https://github.com/ihneo/php/pull/24/files +RUN set -eux; \ + if [[ $PHP_VERSION != 8.3.* ]]; then \ + pecl install imagick && docker-php-ext-enable imagick; \ + fi # deprecated from 5.*, so should be avoided RUN set -eux; \ @@ -105,7 +109,6 @@ RUN set -eux; \ # Install the Microsoft SQL Server PDO driver on supported versions only. # - https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac # - https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server - # For php|8.0, latest stable version of pecl/sqlsrv, pecl/pdo_sqlsrv is 5.11.0 RUN set -eux; \ if [[ $PHP_VERSION == 8.0.* ]]; then \ @@ -116,7 +119,7 @@ RUN set -eux; \ # Latest pecl/sqlsrv, pecl/pdo_sqlsrv requires PHP (version >= 8.1.0) RUN set -eux; \ - if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* ]]; then \ + if [[ $PHP_VERSION == 8.1.* || $PHP_VERSION == 8.2.* || $PHP_VERSION == 8.3.* ]]; then \ pecl install sqlsrv pdo_sqlsrv \ && echo extension=pdo_sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/30-pdo_sqlsrv.ini \ && echo extension=sqlsrv.so >> `php --ini | grep "Scan for additional .ini files" | sed -e "s|.*:\s*||"`/20-sqlsrv.ini; \ diff --git a/platforms/php/prereqs/installPrereqs.sh b/platforms/php/prereqs/installPrereqs.sh index c25d68245e..694109977b 100755 --- a/platforms/php/prereqs/installPrereqs.sh +++ b/platforms/php/prereqs/installPrereqs.sh @@ -36,9 +36,13 @@ then add-apt-repository ppa:xapienz/curl34 -y fi +# Set DEBIAN_FRONTEND environment variable +export DEBIAN_FRONTEND=noninteractive + apt-get update \ && apt-get upgrade -y \ && apt-get install -y \ + apt-utils \ $PHPIZE_DEPS \ ca-certificates \ curl \ diff --git a/platforms/php/versions/bookworm/versionsToBuild.txt b/platforms/php/versions/bookworm/versionsToBuild.txt index e195609c77..342510c74a 100644 --- a/platforms/php/versions/bookworm/versionsToBuild.txt +++ b/platforms/php/versions/bookworm/versionsToBuild.txt @@ -4,3 +4,5 @@ 8.2.9, 1e6cb77f997613864ab3127fbfc6a8c7fdaa89a95e8ed6167617b913b4de4765, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, 8.2.16, 28cdc995b7d5421711c7044294885fcde4390c9f67504a994b4cf9bc1b5cc593, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, + +8.3.4, 39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63, 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA, \ No newline at end of file diff --git a/platforms/php/versions/bullseye/versionsToBuild.txt b/platforms/php/versions/bullseye/versionsToBuild.txt index 3203ad4b2d..32c4fe2bdd 100644 --- a/platforms/php/versions/bullseye/versionsToBuild.txt +++ b/platforms/php/versions/bullseye/versionsToBuild.txt @@ -42,4 +42,5 @@ 8.2.8, cfe1055fbcd486de7d3312da6146949aae577365808790af6018205567609801, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, 8.2.9, 1e6cb77f997613864ab3127fbfc6a8c7fdaa89a95e8ed6167617b913b4de4765, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, 8.2.14, 763ecd39fcf51c3815af6ef6e43fa9aa0d0bd8e5a615009e5f4780c92705f583, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, -8.2.16, 28cdc995b7d5421711c7044294885fcde4390c9f67504a994b4cf9bc1b5cc593, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, \ No newline at end of file +8.2.16, 28cdc995b7d5421711c7044294885fcde4390c9f67504a994b4cf9bc1b5cc593, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, +8.3.4, 39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63, 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA, diff --git a/platforms/php/versions/buster/versionsToBuild.txt b/platforms/php/versions/buster/versionsToBuild.txt index 00a6f3670f..bb7e80db15 100644 --- a/platforms/php/versions/buster/versionsToBuild.txt +++ b/platforms/php/versions/buster/versionsToBuild.txt @@ -56,4 +56,5 @@ 8.2.8, cfe1055fbcd486de7d3312da6146949aae577365808790af6018205567609801, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, 8.2.9, 1e6cb77f997613864ab3127fbfc6a8c7fdaa89a95e8ed6167617b913b4de4765, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, 8.2.14, 763ecd39fcf51c3815af6ef6e43fa9aa0d0bd8e5a615009e5f4780c92705f583, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, -8.2.16, 28cdc995b7d5421711c7044294885fcde4390c9f67504a994b4cf9bc1b5cc593, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, \ No newline at end of file +8.2.16, 28cdc995b7d5421711c7044294885fcde4390c9f67504a994b4cf9bc1b5cc593, 1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544, +8.3.4, 39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63, 1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA, diff --git a/src/BuildScriptGenerator/PhpVersions.cs b/src/BuildScriptGenerator/PhpVersions.cs index d4d4064633..a08f52fe84 100644 --- a/src/BuildScriptGenerator/PhpVersions.cs +++ b/src/BuildScriptGenerator/PhpVersions.cs @@ -6,9 +6,9 @@ namespace Microsoft.Oryx.BuildScriptGenerator.Common { public static class PhpVersions { - public const string PhpRuntimeBaseTag = "20240222.2"; - public const string PhpFpmRuntimeBaseTag = "20240222.2"; - public const string ComposerDefaultVersion = "2.0.8"; + public const string PhpRuntimeBaseTag = "20240318.5"; + public const string PhpFpmRuntimeBaseTag = "20240318.4"; + public const string ComposerDefaultVersion = "2.6.2"; public const string ComposerSetupSha384 = "e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02"; public const string Composer19Version = "1.9.3"; public const string Composer110Version = "1.10.19"; @@ -18,6 +18,9 @@ public static class PhpVersions public const string Composer24Version = "2.4.4"; public const string Composer25Version = "2.5.8"; public const string Composer26Version = "2.6.2"; + public const string Php83Version = "8.3.4"; + public const string Php83Keys = "1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA"; + public const string Php83TarSha256 = "39a337036a546e5c28aea76cf424ac172db5156bd8a8fd85252e389409a5ba63"; public const string Php82Version = "8.2.16"; public const string Php82Keys = "1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544"; public const string Php82TarSha256 = "28cdc995b7d5421711c7044294885fcde4390c9f67504a994b4cf9bc1b5cc593"; @@ -42,7 +45,7 @@ public static class PhpVersions public const string Php56Version = "5.6.40"; public const string Php56Keys = "0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3"; public const string Php56TarSha256 = "1369a51eee3995d7fbd1c5342e5cc917760e276d561595b6052b21ace2656d1c"; - public static readonly List RuntimeVersions = new List { "7.4-debian-bullseye", "7.4-debian-buster", "8.0-debian-bullseye", "8.0-debian-buster", "8.1-debian-bullseye", "8.1-debian-buster", "8.2-debian-bullseye", "8.2-debian-buster" }; - public static readonly List FpmRuntimeVersions = new List { "7.4-fpm-debian-bullseye", "7.4-fpm-debian-buster", "8.0-fpm-debian-bullseye", "8.0-fpm-debian-buster", "8.1-fpm-debian-bullseye", "8.1-fpm-debian-buster", "8.2-fpm-debian-bullseye", "8.2-fpm-debian-buster" }; + public static readonly List RuntimeVersions = new List { "7.4-debian-bullseye", "7.4-debian-buster", "8.0-debian-bullseye", "8.0-debian-buster", "8.1-debian-bullseye", "8.1-debian-buster", "8.2-debian-bullseye", "8.2-debian-buster", "8.3-debian-bullseye", "8.3-debian-buster", "8.3-debian-bookworm" }; + public static readonly List FpmRuntimeVersions = new List { "7.4-fpm-debian-bullseye", "7.4-fpm-debian-buster", "8.0-fpm-debian-bullseye", "8.0-fpm-debian-buster", "8.1-fpm-debian-bullseye", "8.1-fpm-debian-buster", "8.2-fpm-debian-bullseye", "8.2-fpm-debian-buster", "8.3-fpm-debian-bullseye", "8.3-fpm-debian-buster", "8.3-fpm-debian-bookworm" }; } } \ No newline at end of file diff --git a/tests/BuildScriptGenerator.Tests/DefaultDockerfileGeneratorTest.cs b/tests/BuildScriptGenerator.Tests/DefaultDockerfileGeneratorTest.cs index 63fd9d70d3..2a9877f322 100644 --- a/tests/BuildScriptGenerator.Tests/DefaultDockerfileGeneratorTest.cs +++ b/tests/BuildScriptGenerator.Tests/DefaultDockerfileGeneratorTest.cs @@ -124,6 +124,7 @@ public void GenerateDockerfile_GeneratesBuildTagAndRuntime_ForProvidedPlatformAn [InlineData("php", "7.4", "debian-bullseye-stable", "7.4-debian-bullseye")] [InlineData("php", "8.0", "debian-bullseye-stable", "8.0-debian-bullseye")] [InlineData("php", "8.2", "debian-bullseye-stable", "8.2-debian-bullseye")] + [InlineData("php", "8.3", "debian-bullseye-stable", "8.3-debian-bullseye")] [InlineData("python", "3.9", "debian-bookworm-stable", "3.9-debian-bookworm")] [InlineData("python", "3.10", "debian-bookworm-stable", "3.10-debian-bookworm")] [InlineData("python", "3.11", "debian-bookworm-stable", "3.11-debian-bookworm")] @@ -186,6 +187,7 @@ public void GenerateDockerfile_GeneratesBuildTagAndRuntime_ForProvidedPlatform( [InlineData("php", "7.4", "debian-bullseye-stable", "7.4-debian-bullseye")] [InlineData("php", "8.0", "debian-bullseye-stable", "8.0-debian-bullseye")] [InlineData("php", "8.2", "debian-bullseye-stable", "8.2-debian-bullseye")] + [InlineData("php", "8.3", "debian-bullseye-stable", "8.3-debian-bullseye")] [InlineData("python", "3.9", "debian-bookworm-stable", "3.9-debian-bookworm")] [InlineData("python", "3.10", "debian-bookworm-stable", "3.10-debian-bookworm")] [InlineData("python", "3.11", "debian-bookworm-stable", "3.11-debian-bookworm")] diff --git a/tests/Oryx.BuildImage.Tests/Php/PhpDynamicInstallationTest.cs b/tests/Oryx.BuildImage.Tests/Php/PhpDynamicInstallationTest.cs index e8da0a3c2c..98ca5dbf83 100644 --- a/tests/Oryx.BuildImage.Tests/Php/PhpDynamicInstallationTest.cs +++ b/tests/Oryx.BuildImage.Tests/Php/PhpDynamicInstallationTest.cs @@ -36,6 +36,7 @@ public static TheoryData VersionAndImageNameData data.Add(PhpVersions.Php80Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php81Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.ComposerDefaultVersion); + data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.ComposerDefaultVersion); // Test PHP composer version 2.2.x data.Add( @@ -47,6 +48,7 @@ public static TheoryData VersionAndImageNameData data.Add(PhpVersions.Php80Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer22Version); data.Add(PhpVersions.Php81Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer22Version); data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer22Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer22Version); // Test PHP composer version 2.3.x data.Add( @@ -58,6 +60,7 @@ public static TheoryData VersionAndImageNameData data.Add(PhpVersions.Php80Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer23Version); data.Add(PhpVersions.Php81Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer23Version); data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer23Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer23Version); // Test PHP composer version 2.4.x data.Add( @@ -69,6 +72,7 @@ public static TheoryData VersionAndImageNameData data.Add(PhpVersions.Php80Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer24Version); data.Add(PhpVersions.Php81Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer24Version); data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer24Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer24Version); // Test PHP composer version 2.5.x data.Add( @@ -80,6 +84,7 @@ public static TheoryData VersionAndImageNameData data.Add(PhpVersions.Php80Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer25Version); data.Add(PhpVersions.Php81Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer25Version); data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer25Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer25Version); // Test PHP composer version 2.6.x data.Add( @@ -91,6 +96,7 @@ public static TheoryData VersionAndImageNameData data.Add(PhpVersions.Php80Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer26Version); data.Add(PhpVersions.Php81Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer26Version); data.Add(PhpVersions.Php82Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer26Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetGitHubActionsBuildImage(ImageTestHelperConstants.GitHubActionsBuster), PhpVersions.Composer26Version); return data; } } @@ -141,12 +147,14 @@ public static TheoryData VersionAndImageNameDataCliBuste data.Add(PhpVersions.Php80Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php81Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php82Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.ComposerDefaultVersion); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.ComposerDefaultVersion); // Test PHP composer version 2.3.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.Composer23Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBusterTag), PhpVersions.Composer23Version); return data; } } @@ -163,36 +171,42 @@ public static TheoryData VersionAndImageNameDataCliBulls data.Add(PhpVersions.Php80Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php81Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php82Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.ComposerDefaultVersion); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.ComposerDefaultVersion); // Test PHP composer version 2.2.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer22Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer22Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer22Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer22Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer22Version); // Test PHP composer version 2.3.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer23Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer23Version); // Test PHP composer version 2.4.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer24Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer24Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer24Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer24Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer24Version); // Test PHP composer version 2.5.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer25Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer25Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer25Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer25Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer25Version); // Test PHP composer version 2.6.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer26Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer26Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer26Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer26Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliImage(ImageTestHelperConstants.CliBullseyeTag), PhpVersions.Composer26Version); return data; } } @@ -209,36 +223,42 @@ public static TheoryData VersionAndImageNameDataCliBuild data.Add(PhpVersions.Php80Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php81Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.ComposerDefaultVersion); data.Add(PhpVersions.Php82Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.ComposerDefaultVersion); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.ComposerDefaultVersion); // Test PHP composer version 2.2.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer22Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer22Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer22Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer22Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer22Version); // Test PHP composer version 2.3.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer23Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer23Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer23Version); // Test PHP composer version 2.4.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer24Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer24Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer24Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer24Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer24Version); // Test PHP composer version 2.5.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer25Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer25Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer25Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer25Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer25Version); // Test PHP composer version 2.6.x data.Add(PhpVersions.Php74Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer26Version); data.Add(PhpVersions.Php80Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer26Version); data.Add(PhpVersions.Php81Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer26Version); data.Add(PhpVersions.Php82Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer26Version); + data.Add(PhpVersions.Php83Version, imageHelper.GetCliBuilderImage(ImageTestHelperConstants.CliBuilderBullseyeTag), PhpVersions.Composer26Version); return data; } } diff --git a/tests/Oryx.BuildImage.Tests/Php/PhpSampleAppsTest.cs b/tests/Oryx.BuildImage.Tests/Php/PhpSampleAppsTest.cs index a56092a7cf..cec7bd7414 100644 --- a/tests/Oryx.BuildImage.Tests/Php/PhpSampleAppsTest.cs +++ b/tests/Oryx.BuildImage.Tests/Php/PhpSampleAppsTest.cs @@ -62,7 +62,6 @@ public void GeneratesScript_AndBuilds_TwigExample_InLtsVersionsBuildImage() [InlineData(PhpVersions.Php74Version)] [InlineData(PhpVersions.Php73Version)] [InlineData(PhpVersions.Php72Version)] - [InlineData(PhpVersions.Php70Version)] public void GeneratesScript_AndBuilds_TwigExample(string phpVersion) { // Arrange @@ -149,7 +148,6 @@ private void GeneratesScript_AndBuilds_TwigExample_WithDynamicInstallation(strin [InlineData(PhpVersions.Php74Version)] [InlineData(PhpVersions.Php73Version)] [InlineData(PhpVersions.Php72Version)] - [InlineData(PhpVersions.Php70Version)] public void GeneratesScript_AndBuilds_WithoutComposerFile(string phpVersion) { // Arrange diff --git a/tests/Oryx.Integration.Tests/Php/PhpDynamicInstallationTest.cs b/tests/Oryx.Integration.Tests/Php/PhpDynamicInstallationTest.cs index d0656d7aea..eab3be5d00 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpDynamicInstallationTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpDynamicInstallationTest.cs @@ -23,6 +23,27 @@ public PhpDynamicInstallationTest(ITestOutputHelper output, TestTempDirTestFixtu // Unique category traits are needed to run each // platform-version in it's own pipeline agent. This is // because our agents currently a space limit of 10GB. + [Fact, Trait("category", "php-8.3")] + [Trait("build-image", "github-actions-debian-buster")] + public async Task PipelineTestInvocationsPhp83_WithBusterEnvironmentAsync() + { + await CanBuildAndRunAppAsync("8.3", ImageTestHelperConstants.OsTypeDebianBuster, ImageTestHelperConstants.GitHubActionsBuster); + } + + [Fact, Trait("category", "php-8.3")] + [Trait("build-image", "github-actions-debian-bullseye")] + public async Task PipelineTestInvocationsPhp83_WithBullseyeEnvironmentAsync() + { + await CanBuildAndRunAppAsync("8.3", ImageTestHelperConstants.OsTypeDebianBullseye, ImageTestHelperConstants.GitHubActionsBullseye); + } + + [Fact, Trait("category", "php-8.3")] + [Trait("build-image", "github-actions-debian-bookworm")] + public async Task PipelineTestInvocationsPhp83_WithBookwormEnvironmentAsync() + { + await CanBuildAndRunAppAsync("8.3", ImageTestHelperConstants.OsTypeDebianBookworm, ImageTestHelperConstants.GitHubActionsBookworm); + } + [Fact, Trait("category", "php-8.2")] [Trait("build-image", "github-actions-debian-buster")] public async Task PipelineTestInvocationsPhp82_WithBusterEnvironmentAsync() diff --git a/tests/Oryx.Integration.Tests/Php/PhpExifTest.cs b/tests/Oryx.Integration.Tests/Php/PhpExifTest.cs index 0b461bf763..35e16794b9 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpExifTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpExifTest.cs @@ -25,6 +25,16 @@ public PhpExifTest(ITestOutputHelper output, TestTempDirTestFixture fixture) // Unique category traits are needed to run each // platform-version in it's own pipeline agent. This is // because our agents currently a space limit of 10GB. + [Fact, Trait("category", "php-8.3")] + [Trait("build-image", "debian-stretch")] + public async Task PipelineTestInvocationsPhp83Async() + { + string phpVersion83 = "8.3"; + await Task.WhenAll( + ExifExampleAsync(phpVersion83, ImageTestHelperConstants.OsTypeDebianBullseye), + PhpFpmExifExampleAsync(phpVersion83, ImageTestHelperConstants.OsTypeDebianBullseye)); + } + [Fact, Trait("category", "php-8.2")] [Trait("build-image", "debian-stretch")] public async Task PipelineTestInvocationsPhp82Async() diff --git a/tests/Oryx.Integration.Tests/Php/PhpGdTest.cs b/tests/Oryx.Integration.Tests/Php/PhpGdTest.cs index 0153166746..be7e87fa4c 100644 --- a/tests/Oryx.Integration.Tests/Php/PhpGdTest.cs +++ b/tests/Oryx.Integration.Tests/Php/PhpGdTest.cs @@ -24,6 +24,16 @@ public PhpGdTest(ITestOutputHelper output, TestTempDirTestFixture fixture) // Unique category traits are needed to run each // platform-version in it's own pipeline agent. This is // because our agents currently a space limit of 10GB. + [Fact, Trait("category", "php-8.3")] + [Trait("build-image", "debian-stretch")] + public async Task PipelineTestInvocationsPhp83Async() + { + string phpVersion83 = "8.3"; + await Task.WhenAll( + GdExampleAsync(phpVersion83, ImageTestHelperConstants.OsTypeDebianBullseye), + PhpFpmGdExampleAsync(phpVersion83, ImageTestHelperConstants.OsTypeDebianBullseye)); + } + [Fact, Trait("category", "php-8.2")] [Trait("build-image", "debian-stretch")] public async Task PipelineTestInvocationsPhp82Async() diff --git a/tests/Oryx.RuntimeImage.Tests/Php-fpm/PhpFpmImageTest.cs b/tests/Oryx.RuntimeImage.Tests/Php-fpm/PhpFpmImageTest.cs index 63cbb59e85..f04f4e87cc 100644 --- a/tests/Oryx.RuntimeImage.Tests/Php-fpm/PhpFpmImageTest.cs +++ b/tests/Oryx.RuntimeImage.Tests/Php-fpm/PhpFpmImageTest.cs @@ -43,6 +43,7 @@ public PhpFpmImageTest(ITestOutputHelper output, TestTempDirTestFixture testTemp [InlineData("8.0-fpm", PhpVersions.Php80Version)] [InlineData("8.1-fpm", PhpVersions.Php81Version)] [InlineData("8.2-fpm", PhpVersions.Php82Version)] + [InlineData("8.3-fpm", PhpVersions.Php83Version)] [Trait(TestConstants.Category, TestConstants.Release)] public void VersionMatchesBusterImageName(string version, string expectedPhpVersion) { @@ -68,6 +69,7 @@ public void VersionMatchesBusterImageName(string version, string expectedPhpVers [InlineData("8.0-fpm", PhpVersions.Php80Version)] [InlineData("8.1-fpm", PhpVersions.Php81Version)] [InlineData("8.2-fpm", PhpVersions.Php82Version)] + [InlineData("8.3-fpm", PhpVersions.Php83Version)] [Trait(TestConstants.Category, TestConstants.Release)] public void VersionMatchesBullseyeImageName(string version, string expectedPhpVersion) { @@ -87,12 +89,35 @@ public void VersionMatchesBullseyeImageName(string version, string expectedPhpVe result.GetDebugInfo()); } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3-fpm", PhpVersions.Php83Version)] + [Trait(TestConstants.Category, TestConstants.Release)] + public void VersionMatchesBookwormImageName(string version, string expectedPhpVersion) + { + // Arrange & Act + var result = _dockerCli.Run( + _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + "php", + new[] { "--version" } + ); + + // Assert + RunAsserts(() => + { + Assert.True(result.IsSuccess); + Assert.Contains("PHP " + expectedPhpVersion, result.StdOut); + }, + result.GetDebugInfo()); + } + [Theory] [Trait("category", "runtime-buster")] [InlineData("7.4-fpm")] [InlineData("8.0-fpm")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void GraphicsExtension_Gd_IsInstalled_For_Buster(string version) { // Arrange & Act @@ -117,6 +142,7 @@ public void GraphicsExtension_Gd_IsInstalled_For_Buster(string version) [InlineData("8.0-fpm")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void GraphicsExtension_Gd_IsInstalled_For_Bullseye(string version) { // Arrange & Act @@ -135,6 +161,27 @@ public void GraphicsExtension_Gd_IsInstalled_For_Bullseye(string version) Assert.True((bool)((JValue)gdInfo.GetValue("PNG Support")).Value); } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3-fpm")] + public void GraphicsExtension_Gd_IsInstalled_For_Bookworm(string version) + { + // Arrange & Act + var result = _dockerCli.Run(new DockerRunArguments + { + ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + CommandToExecuteOnRun = "php", + CommandArguments = new[] { "-r", "echo json_encode(gd_info());" } + }); + + // Assert + JObject gdInfo = JsonConvert.DeserializeObject(result.StdOut); + Assert.True((bool)((JValue)gdInfo.GetValue("GIF Read Support")).Value); + Assert.True((bool)((JValue)gdInfo.GetValue("GIF Create Support")).Value); + Assert.True((bool)((JValue)gdInfo.GetValue("JPEG Support")).Value); + Assert.True((bool)((JValue)gdInfo.GetValue("PNG Support")).Value); + } + [Theory] [Trait("category", "runtime-buster")] [InlineData("7.4-fpm")] @@ -189,6 +236,7 @@ public void MySqlnd_Azure_IsInstalled_For_Bullseye(string version) [InlineData("8.0-fpm")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void PhpFpmBullseyeRuntimeImage_Contains_VersionAndCommit_Information(string version) { // we cant always rely on gitcommitid as env variable in case build context is not correctly passed @@ -229,6 +277,7 @@ public void PhpFpmBullseyeRuntimeImage_Contains_VersionAndCommit_Information(str [InlineData("8.0-fpm")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void PhpFpmBusterRuntimeImage_Contains_VersionAndCommit_Information(string version) { // we cant always rely on gitcommitid as env variable in case build context is not correctly passed @@ -263,12 +312,50 @@ public void PhpFpmBusterRuntimeImage_Contains_VersionAndCommit_Information(strin result.GetDebugInfo()); } + [SkippableTheory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3-fpm")] + public void PhpFpmBookwormRuntimeImage_Contains_VersionAndCommit_Information(string version) + { + // we cant always rely on gitcommitid as env variable in case build context is not correctly passed + // so we should check agent_os environment variable to know if the build is happening in azure devops agent + // or locally, locally we need to skip this test + var agentOS = Environment.GetEnvironmentVariable("AGENT_OS"); + Skip.If(string.IsNullOrEmpty(agentOS)); + + // Arrange + var gitCommitID = GitHelper.GetCommitID(); + var buildNumber = Environment.GetEnvironmentVariable("BUILD_BUILDNUMBER"); + var expectedOryxVersion = string.Concat(Settings.OryxVersion, buildNumber); + + // Act + var result = _dockerCli.Run(new DockerRunArguments + { + ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + CommandToExecuteOnRun = "oryx", + CommandArguments = new[] { "version" } + }); + + // Assert + RunAsserts( + () => + { + Assert.True(result.IsSuccess); + Assert.NotNull(result.StdErr); + Assert.DoesNotContain(".unspecified, Commit: unspecified", result.StdOut); + Assert.Contains(gitCommitID, result.StdOut); + Assert.Contains(expectedOryxVersion, result.StdOut); + }, + result.GetDebugInfo()); + } + [Theory] [Trait("category", "runtime-bullseye")] [InlineData("7.4-fpm")] [InlineData("8.0-fpm")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void Redis_IsInstalled_For_Bullseye(string version) { // Arrange & Act @@ -296,6 +383,7 @@ public void Redis_IsInstalled_For_Bullseye(string version) [InlineData("8.0-fpm")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void Redis_IsInstalled_For_Buster(string version) { // Arrange & Act @@ -317,11 +405,36 @@ public void Redis_IsInstalled_For_Buster(string version) } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3-fpm")] + public void Redis_IsInstalled_For_Bookworm(string version) + { + // Arrange & Act + var result = _dockerCli.Run(new DockerRunArguments + { + ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + CommandToExecuteOnRun = "php", + CommandArguments = new[] { "-m", " | grep redis);" } + }); + + // Assert + var output = result.StdOut.ToString(); + RunAsserts(() => + { + Assert.True(result.IsSuccess); + Assert.Contains("redis", output); + }, + result.GetDebugInfo()); + + } + [Theory] [Trait("category", "runtime-buster")] [InlineData("8.0-fpm")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void SqlSrv_IsInstalled_For_Buster(string version) { // Arrange & Act @@ -347,6 +460,7 @@ public void SqlSrv_IsInstalled_For_Buster(string version) [InlineData("8.0-fpm")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void SqlSrv_IsInstalled_For_Bullseye(string version) { // Arrange & Act @@ -367,10 +481,34 @@ public void SqlSrv_IsInstalled_For_Bullseye(string version) result.GetDebugInfo()); } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3-fpm")] + public void SqlSrv_IsInstalled_For_Bookworm(string version) + { + // Arrange & Act + var result = _dockerCli.Run(new DockerRunArguments + { + ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + CommandToExecuteOnRun = "php", + CommandArguments = new[] { "-m", " | grep pdo_sqlsrv);" } + }); + + // Assert + var output = result.StdOut.ToString(); + RunAsserts(() => + { + Assert.True(result.IsSuccess); + Assert.Contains("pdo_sqlsrv", output); + }, + result.GetDebugInfo()); + } + [Theory] [Trait("category", "runtime-bullseye")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void Mongodb_IsInstalled_For_Bullseye(string version) { // Arrange & Act @@ -395,6 +533,7 @@ public void Mongodb_IsInstalled_For_Bullseye(string version) [Trait("category", "runtime-buster")] [InlineData("8.1-fpm")] [InlineData("8.2-fpm")] + [InlineData("8.3-fpm")] public void Mongodb_IsInstalled_For_Buster(string version) { // Arrange & Act @@ -414,5 +553,28 @@ public void Mongodb_IsInstalled_For_Buster(string version) }, result.GetDebugInfo()); } + + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3-fpm")] + public void Mongodb_IsInstalled_For_Bookworm(string version) + { + // Arrange & Act + var result = _dockerCli.Run(new DockerRunArguments + { + ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + CommandToExecuteOnRun = "php", + CommandArguments = new[] { "-m", " | grep mongodb);" } + }); + + // Assert + var output = result.StdOut.ToString(); + RunAsserts(() => + { + Assert.True(result.IsSuccess); + Assert.Contains("mongodb", output); + }, + result.GetDebugInfo()); + } } } diff --git a/tests/Oryx.RuntimeImage.Tests/Php/PhpImageTest.cs b/tests/Oryx.RuntimeImage.Tests/Php/PhpImageTest.cs index cc09c3a740..3c89332407 100644 --- a/tests/Oryx.RuntimeImage.Tests/Php/PhpImageTest.cs +++ b/tests/Oryx.RuntimeImage.Tests/Php/PhpImageTest.cs @@ -45,6 +45,7 @@ public PhpImageTest(ITestOutputHelper output, TestTempDirTestFixture testTempDir [InlineData("8.0", PhpVersions.Php80Version)] [InlineData("8.1", PhpVersions.Php81Version)] [InlineData("8.2", PhpVersions.Php82Version)] + [InlineData("8.3", PhpVersions.Php83Version)] [Trait(TestConstants.Category, TestConstants.Release)] public void VersionMatchesBusterImageName(string version, string expectedPhpVersion) { @@ -70,6 +71,7 @@ public void VersionMatchesBusterImageName(string version, string expectedPhpVers [InlineData("8.0", PhpVersions.Php80Version)] [InlineData("8.1", PhpVersions.Php81Version)] [InlineData("8.2", PhpVersions.Php82Version)] + [InlineData("8.3", PhpVersions.Php83Version)] [Trait(TestConstants.Category, TestConstants.Release)] public void VersionMatchesBullseyeImageName(string version, string expectedPhpVersion) { @@ -89,12 +91,35 @@ public void VersionMatchesBullseyeImageName(string version, string expectedPhpVe result.GetDebugInfo()); } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3", PhpVersions.Php83Version)] + [Trait(TestConstants.Category, TestConstants.Release)] + public void VersionMatchesBookwormImageName(string version, string expectedPhpVersion) + { + // Arrange & Act + var result = _dockerCli.Run( + _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + "php", + new[] { "--version" } + ); + + // Assert + RunAsserts(() => + { + Assert.True(result.IsSuccess); + Assert.Contains("PHP " + expectedPhpVersion, result.StdOut); + }, + result.GetDebugInfo()); + } + [Theory] [Trait("category", "runtime-buster")] [InlineData("7.4")] [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void GraphicsExtension_Gd_IsInstalled_For_Buster_Image(string version) { // Arrange & Act @@ -120,6 +145,7 @@ public void GraphicsExtension_Gd_IsInstalled_For_Buster_Image(string version) [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void GraphicsExtension_Gd_IsInstalled_For_Bullseye_Image(string version) { // Arrange & Act @@ -139,12 +165,35 @@ public void GraphicsExtension_Gd_IsInstalled_For_Bullseye_Image(string version) Assert.True((bool)((JValue)gdInfo.GetValue("PNG Support")).Value); } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3")] + public void GraphicsExtension_Gd_IsInstalled_For_Bookworm_Image(string version) + { + // Arrange & Act + var result = _dockerCli.Run(new DockerRunArguments + { + ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + CommandToExecuteOnRun = "php", + CommandArguments = new[] { "-r", "echo json_encode(gd_info());" } + }); + + // Assert + JObject gdInfo = JsonConvert.DeserializeObject(result.StdOut); + //Assert.Contains((((JValue)gdInfo.GetValue("GIF Read Support")).Value).ToString(), "true"); + Assert.True((bool)((JValue)gdInfo.GetValue("GIF Read Support")).Value); + Assert.True((bool)((JValue)gdInfo.GetValue("GIF Create Support")).Value); + Assert.True((bool)((JValue)gdInfo.GetValue("JPEG Support")).Value); + Assert.True((bool)((JValue)gdInfo.GetValue("PNG Support")).Value); + } + [Theory] [Trait("category", "runtime-buster")] [InlineData("7.4")] [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public async Task Check_If_Apache_Allows_Casing_In_PHP_File_ExtensionAsync_For_Buster(string version) { // Arrange @@ -217,6 +266,7 @@ await EndToEndTestHelper.RunAndAssertAppAsync( [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public async Task Check_If_Apache_Allows_Casing_In_PHP_File_ExtensionAsync_For_Bullseye(string version) { // Arrange @@ -283,12 +333,82 @@ await EndToEndTestHelper.RunAndAssertAppAsync( dockerCli: _dockerCli); } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3")] + public async Task Check_If_Apache_Allows_Casing_In_PHP_File_ExtensionAsync_For_Bookworm(string version) + { + // Arrange + var appName = "imagick-example"; + var hostDir = Path.Combine(_hostSamplesDir, "php", appName); + var volume = CreateSampleAppVolume(hostDir); + var appDir = volume.ContainerDir; + + var testSiteConfigApache2 = + @" + \nServerAdmin php-x@localhost + \nDocumentRoot /var/www/php-x/ + \nServerName localhost + \nServerAlias www.php-x.com + + \n + \n Options FollowSymLinks + \n AllowOverride None + \n + \n + Require all granted + \n + + \nErrorLog /var/www/php-x/error.log + \nCustomLog /var/www/php-x/access.log combined + "; + + int containerPort = 8080; + var customSiteConfig = @"echo '" + testSiteConfigApache2 + "' > /etc/apache2/sites-available/php-x.conf"; + var portConfig = @"sed -i -e 's!\${APACHE_PORT}!" + containerPort + "!g' /etc/apache2/ports.conf /etc/apache2/sites-available/*.conf"; + var documentRootConfig = @"sed -i -e 's!\${APACHE_DOCUMENT_ROOT}!/var/www/php-x/!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf /etc/apache2/sites-available/*.conf"; + var script = new ShellScriptBuilder() + .AddCommand("mkdir -p /var/www/php-x") + .AddCommand("echo '' > /var/www/php-x/error.log") + .AddCommand("echo '' > /var/www/php-x/access.log") + .AddCommand("echo '' > /var/www/php-x/inDex.PhP") + .AddCommand("chmod -R +x /var/www/php-x") + .AddCommand(documentRootConfig) + .AddCommand(portConfig) + .AddCommand("echo 'ServerName localhost' >> /etc/apache2/apache2.conf") + .AddCommand(customSiteConfig) + .AddCommand("a2ensite php-x.conf") // load custom site + .AddCommand("service apache2 start") // start apache with the custom site configuration + .AddCommand("tail -f /dev/null") //foreground process to keep the container alive + .ToString(); + + // Assert + await EndToEndTestHelper.RunAndAssertAppAsync( + imageName: _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + output: _output, + volumes: new List { volume }, + environmentVariables: null, + port: containerPort, + link: null, + runCmd: "/bin/sh", + runArgs: new[] { "-c", script }, + assertAction: async (hostPort) => + { + var data = await _httpClient.GetStringAsync($"http://localhost:{hostPort}/inDex.PhP"); + Assert.DoesNotContain("", data); + }, + dockerCli: _dockerCli); + } + [Theory] [Trait("category", "runtime-buster")] [InlineData("7.4")] [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void MongoDb_IsInstalled_For_Buster(string version) { // Arrange & Act @@ -316,6 +436,7 @@ public void MongoDb_IsInstalled_For_Buster(string version) [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void MongoDb_IsInstalled_For_Bullseye(string version) { // Arrange & Act @@ -337,6 +458,30 @@ public void MongoDb_IsInstalled_For_Bullseye(string version) } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3")] + public void MongoDb_IsInstalled_For_Bookworm(string version) + { + // Arrange & Act + var result = _dockerCli.Run(new DockerRunArguments + { + ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + CommandToExecuteOnRun = "php", + CommandArguments = new[] { "-m", " | grep mongodb);" } + }); + + // Assert + var output = result.StdOut.ToString(); + RunAsserts(() => + { + Assert.True(result.IsSuccess); + Assert.Contains("mongodb", output); + }, + result.GetDebugInfo()); + + } + [Theory] [Trait("category", "runtime-buster")] [InlineData("7.4")] @@ -391,6 +536,7 @@ public void MySqlnd_Azure_IsInstalled_For_Bullseye(string version) [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void PhpRuntimeBusterImage_Contains_VersionAndCommit_Information(string version) { // we cant always rely on gitcommitid as env variable in case build context is not correctly passed @@ -431,6 +577,7 @@ public void PhpRuntimeBusterImage_Contains_VersionAndCommit_Information(string v [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void PhpRuntimeBullseyeImage_Contains_VersionAndCommit_Information(string version) { // we cant always rely on gitcommitid as env variable in case build context is not correctly passed @@ -471,6 +618,7 @@ public void PhpRuntimeBullseyeImage_Contains_VersionAndCommit_Information(string [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void Redis_IsInstalled_For_Buster(string version) { // Arrange & Act @@ -498,6 +646,7 @@ public void Redis_IsInstalled_For_Buster(string version) [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void Redis_IsInstalled_For_Bullseye(string version) { // Arrange & Act @@ -524,6 +673,7 @@ public void Redis_IsInstalled_For_Bullseye(string version) [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void SqlSrv_IsInstalled_For_Buster(string version) { // Arrange & Act @@ -550,6 +700,7 @@ public void SqlSrv_IsInstalled_For_Buster(string version) [InlineData("8.0")] [InlineData("8.1")] [InlineData("8.2")] + [InlineData("8.3")] public void SqlSrv_IsInstalled_For_Bullseye(string version) { // Arrange & Act @@ -568,7 +719,29 @@ public void SqlSrv_IsInstalled_For_Bullseye(string version) Assert.Contains("pdo_sqlsrv", output); }, result.GetDebugInfo()); + } + [Theory] + [Trait("category", "runtime-bookworm")] + [InlineData("8.3")] + public void SqlSrv_IsInstalled_For_Bookworm(string version) + { + // Arrange & Act + var result = _dockerCli.Run(new DockerRunArguments + { + ImageId = _imageHelper.GetRuntimeImage("php", version, ImageTestHelperConstants.OsTypeDebianBookworm), + CommandToExecuteOnRun = "php", + CommandArguments = new[] { "-m", " | grep pdo_sqlsrv);" } + }); + + // Assert + var output = result.StdOut.ToString(); + RunAsserts(() => + { + Assert.True(result.IsSuccess); + Assert.Contains("pdo_sqlsrv", output); + }, + result.GetDebugInfo()); } } } diff --git a/vsts/pipelines/baseImages/php-fpm.yml b/vsts/pipelines/baseImages/php-fpm.yml index 6ce7661854..f2bf16197a 100644 --- a/vsts/pipelines/baseImages/php-fpm.yml +++ b/vsts/pipelines/baseImages/php-fpm.yml @@ -18,7 +18,7 @@ jobs: imageDebianFlavor: buster artifactsFileName: php-fpm-runtimeimage-bases-buster.txt jobName: Build_PHP_FPM_Buster_Base - + - template: ../templates/_buildimageBasesJobTemplate.yml parameters: displayName: Build php bullseye runtime base images @@ -27,11 +27,21 @@ jobs: imageDebianFlavor: bullseye artifactsFileName: php-fpm-runtimeimage-bases-bullseye.txt jobName: Build_PHP_Fpm_Bullseye_Base + +- template: ../templates/_buildimageBasesJobTemplate.yml + parameters: + displayName: Build php bookworm runtime base images + scriptPath: ./build/buildRunTimeImageBases.sh + imageDir: php-fpm + imageDebianFlavor: bookworm + artifactsFileName: php-fpm-runtimeimage-bases-bookworm.txt + jobName: Build_PHP_Fpm_Bookworm_Base - job: Release_PhpRuntimeBaseImage - dependsOn: + dependsOn: - Build_Php_Fpm_Buster_Base - - Build_PHP_Fpm_Bullseye_Base + - Build_PHP_Fpm_Bullseye_Base + - Build_PHP_Fpm_Bookworm_Base displayName: Push images to MCR timeoutInMinutes: 250 pool: diff --git a/vsts/pipelines/baseImages/php.yml b/vsts/pipelines/baseImages/php.yml index 47becde494..78944bd174 100644 --- a/vsts/pipelines/baseImages/php.yml +++ b/vsts/pipelines/baseImages/php.yml @@ -18,7 +18,7 @@ jobs: imageDebianFlavor: buster artifactsFileName: php-runtimeimage-bases-buster.txt jobName: Build_Buster_BaseImages - + - template: ../templates/_buildimageBasesJobTemplate.yml parameters: displayName: Build php runtime bullseye base images @@ -27,11 +27,21 @@ jobs: imageDebianFlavor: bullseye artifactsFileName: php-runtimeimage-bases-bullseye.txt jobName: Build_Bullseye_BaseImages + +- template: ../templates/_buildimageBasesJobTemplate.yml + parameters: + displayName: Build php runtime bookworm base images + scriptPath: ./build/buildRunTimeImageBases.sh + imageDir: php + imageDebianFlavor: bookworm + artifactsFileName: php-runtimeimage-bases-bookworm.txt + jobName: Build_Bookworm_BaseImages - job: Release_PhpRuntimeBaseImage dependsOn: - Build_Buster_BaseImages - - Build_Bullseye_BaseImages + - Build_Bullseye_BaseImages + - Build_Bookworm_BaseImages displayName: Push images to MCR timeoutInMinutes: 250 pool: diff --git a/vsts/pipelines/nightly.yml b/vsts/pipelines/nightly.yml index 0a1a2397ea..cbef3404df 100644 --- a/vsts/pipelines/nightly.yml +++ b/vsts/pipelines/nightly.yml @@ -118,16 +118,17 @@ stages: parameters: imageType: ${{ buildImage.value }} - - job: Job_BuilderImages - displayName: Build Builder Images - pool: - name: AzurePipelines-EO - demands: - - ImageOverride -equals AzurePipelinesUbuntu20.04compliant - timeoutInMinutes: 480 - steps: - - template: templates/_builderTemplate.yml - dependsOn: Job_BuildImage_CliBuilderBullseye +# commented out temporarily + # - job: Job_BuilderImages + # displayName: Build Builder Images + # pool: + # name: AzurePipelines-EO + # demands: + # - ImageOverride -equals AzurePipelinesUbuntu20.04compliant + # timeoutInMinutes: 480 + # steps: + # - template: templates/_builderTemplate.yml + # dependsOn: Job_BuildImage_CliBuilderBullseye - job: Job_Buster_RuntimeImages displayName: Build and Test Buster Runtime Images diff --git a/vsts/pipelines/templates/_buildTemplate.yml b/vsts/pipelines/templates/_buildTemplate.yml index 6881231f01..db47fbd943 100644 --- a/vsts/pipelines/templates/_buildTemplate.yml +++ b/vsts/pipelines/templates/_buildTemplate.yml @@ -59,6 +59,13 @@ steps: inputs: ignoreDirectories: '$(Build.SourcesDirectory)/tests' +- task: Docker@1 + displayName: Container registry logout + inputs: + command: logout + azureSubscriptionEndpoint: ${{ parameters.ascName }} + azureContainerRegistry: ${{ parameters.acrName }} + - task: Docker@1 displayName: Container registry login inputs: diff --git a/vsts/pipelines/templates/integrationTests/_phpIntegrationJobTemplate.yml b/vsts/pipelines/templates/integrationTests/_phpIntegrationJobTemplate.yml index 53f61cb27a..4b0c85605f 100644 --- a/vsts/pipelines/templates/integrationTests/_phpIntegrationJobTemplate.yml +++ b/vsts/pipelines/templates/integrationTests/_phpIntegrationJobTemplate.yml @@ -9,12 +9,22 @@ parameters: buildTag: 'github-actions-debian-buster' - category: '8.0' buildTag: 'github-actions-debian-buster' + - category: '8.0' + buildTag: 'github-actions-debian-bullseye' - category: '8.1' buildTag: 'github-actions-debian-buster' + - category: '8.1' + buildTag: 'github-actions-debian-bullseye' - category: '8.2' buildTag: 'github-actions-debian-buster' - category: '8.2' buildTag: 'github-actions-debian-bullseye' + - category: '8.3' + buildTag: 'github-actions-debian-buster' + - category: '8.3' + buildTag: 'github-actions-debian-bullseye' + - category: '8.3' + buildTag: 'github-actions-debian-bookworm' jobs: - ${{ each mapping in parameters.testMappings }}: diff --git a/vsts/pipelines/validation.yml b/vsts/pipelines/validation.yml index b319233c90..a7afdcede7 100644 --- a/vsts/pipelines/validation.yml +++ b/vsts/pipelines/validation.yml @@ -87,16 +87,17 @@ jobs: parameters: imageType: ${{ buildImage.value }} -- job: Job_BuilderImages - displayName: Build Builder Images - pool: - name: AzurePipelines-EO - demands: - - ImageOverride -equals AzurePipelinesUbuntu20.04compliant - timeoutInMinutes: 480 - steps: - - template: templates/_builderTemplate.yml - dependsOn: Job_BuildImage_CliBuilderBullseye +# commented out temporarily +# - job: Job_BuilderImages +# displayName: Build Builder Images +# pool: +# name: AzurePipelines-EO +# demands: +# - ImageOverride -equals AzurePipelinesUbuntu20.04compliant +# timeoutInMinutes: 480 +# steps: +# - template: templates/_builderTemplate.yml +# dependsOn: Job_BuildImage_CliBuilderBullseye - job: Job_Buster_RuntimeImages displayName: Build and Test Buster Runtime Images diff --git a/vsts/scripts/tagBaseImagesForRelease.sh b/vsts/scripts/tagBaseImagesForRelease.sh index 923caf30b5..3eeee31008 100644 --- a/vsts/scripts/tagBaseImagesForRelease.sh +++ b/vsts/scripts/tagBaseImagesForRelease.sh @@ -86,12 +86,14 @@ then echo "" retagImageWithStagingRepository php-runtimeimage-bases-buster.txt $imageName buster retagImageWithStagingRepository php-runtimeimage-bases-bullseye.txt $imageName bullseye + retagImageWithStagingRepository php-runtimeimage-bases-bookworm.txt $imageName bookworm elif [ "$imageName" == "php-fpm" ] then echo "" echo $imageName retagImageWithStagingRepository php-fpm-runtimeimage-bases-buster.txt $imageName buster retagImageWithStagingRepository php-fpm-runtimeimage-bases-bullseye.txt $imageName bullseye + retagImageWithStagingRepository php-fpm-runtimeimage-bases-bookworm.txt $imageName bookworm elif [ "$imageName" == "dotnetcore" ] then echo ""