Add Php Fpm runtime and Ruby versions (#927)

This commit is contained in:
Zixuan Qian 2021-02-18 09:03:43 -08:00 коммит произвёл GitHub
Родитель 6cd0c07522
Коммит ddd7afece8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
29 изменённых файлов: 660 добавлений и 50 удалений

Просмотреть файл

@ -1,7 +1,7 @@
# This file was auto-generated from 'constants.yaml'. Changes may be overridden.
PHP_RUNTIME_BASE_TAG='20210127.6'
PHP_FPM_RUNTIME_BASE_TAG='20210128.1'
PHP_FPM_RUNTIME_BASE_TAG='20210209.2'
COMPOSER_VERSION='1.9.3'
COMPOSER_SETUP_SHA384='756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3'
COMPOSER1_9_VERSION='1.9.3'

Просмотреть файл

@ -1,8 +1,8 @@
# This file was auto-generated from 'constants.yaml'. Changes may be overridden.
GEM_VERSION='3.1.4'
RUBY27_VERSION='2.7.1'
RUBY27_TAR_SHA256='b224f9844646cc92765df8288a46838511c1cec5b550d8874bd4686a904fcee7'
GEM_VERSION='3.2.9'
RUBY27_VERSION='2.7.2'
RUBY27_TAR_SHA256='6e5706d0d4ee4e1e2f883db9d768586b4d06567debea353c796ec45e8321c3d4'
RUBY26_VERSION='2.6.6'
RUBY26_TAR_SHA256='5db187882b7ac34016cd48d7032e197f07e4968f406b0690e20193b9b424841f'
RUBY25_VERSION='2.5.8'

Просмотреть файл

@ -85,7 +85,7 @@
- name: php-versions
constants:
php-runtime-base-tag: 20210127.6
php-fpm-runtime-base-tag: 20210128.1
php-fpm-runtime-base-tag: 20210209.2
composer-version: 1.9.3
composer-setup-sha384: 756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3
composer1-9-version: 1.9.3
@ -122,10 +122,10 @@
file-name-prefix: __
- name: ruby-versions
constants:
gem-version: 3.1.4
gem-version: 3.2.9
# hashes are for .tar.xz
ruby27-version: 2.7.1
ruby27-tar-sha256: b224f9844646cc92765df8288a46838511c1cec5b550d8874bd4686a904fcee7
ruby27-version: 2.7.2
ruby27-tar-sha256: 6e5706d0d4ee4e1e2f883db9d768586b4d06567debea353c796ec45e8321c3d4
ruby26-version: 2.6.6
ruby26-tar-sha256: 5db187882b7ac34016cd48d7032e197f07e4968f406b0690e20193b9b424841f
ruby25-version: 2.5.8

Просмотреть файл

@ -32,7 +32,7 @@ The latest version of *gem* is used to install dependencies.
# Version support
The Ruby project defines this [release schedule][]. Oryx supports all actively supported
releases (2.5.8, 2.6.6, 2.7.1).
releases (2.5.8, 2.6.6, 2.7.1, 2.7.2, 3.0.0).
We will update the `patch` version of a release at least once every 3 months,
replacing the previous `patch` version for that release.

Просмотреть файл

@ -204,6 +204,8 @@
### ruby
- 3.0.0
- 2.7.2
- 2.7.1
- 2.6.6
- 2.5.8

Просмотреть файл

@ -74,7 +74,7 @@ RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \
# - 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 == 7.2.* || $PHP_VERSION == 7.3.* ]]; then \
if [[ $PHP_VERSION == 7.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; \
@ -98,14 +98,6 @@ RUN { \
echo 'zend_extension=opcache'; \
} > /usr/local/etc/php/conf.d/php.ini
# 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; \
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;
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \

Просмотреть файл

@ -74,7 +74,7 @@ RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \
# - 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 == 7.2.* || $PHP_VERSION == 7.3.* ]]; then \
if [[ $PHP_VERSION == 7.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; \
@ -98,14 +98,6 @@ RUN { \
echo 'zend_extension=opcache'; \
} > /usr/local/etc/php/conf.d/php.ini
# 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; \
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;
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \

Просмотреть файл

@ -0,0 +1,261 @@
ARG DEBIAN_FLAVOR
# From https://github.com/docker-library/php.git
FROM 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/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& apt-get update \
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev
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
##<autogenerated>##
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi
##</autogenerated>##
# 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 1729F83938DA44E27BA0F4D3DBDB397470D12172 BFDDD28642824F8118EF77909B67A5C12229118F
ENV PHP_VERSION 8.0.1
ENV PHP_URL="https://www.php.net/get/php-8.0.1.tar.xz/from/this/mirror" PHP_ASC_URL="https://www.php.net/get/php-8.0.1.tar.xz.asc/from/this/mirror"
ENV PHP_SHA256="208b3330af881b44a6a8c6858d569c72db78dab97810332978cc65206b0ec2dc" 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; \
\
wget https://github.com/P-H-C/phc-winner-argon2/archive/20190702.tar.gz -O /tmp/argon2.tar.gz; \
tar -xf /tmp/argon2.tar.gz; \
ls -l; \
cd phc-winner-argon2-20190702; \
make; \
make test; \
make install PREFIX=/usr;
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"]
##<autogenerated>##
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"]
##</autogenerated>##

Просмотреть файл

@ -0,0 +1,9 @@
#!/bin/sh
set -e
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi
exec "$@"

Просмотреть файл

@ -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 "$@"

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1 @@
php:8.0-fpm

Просмотреть файл

@ -3,4 +3,4 @@
declare -r __DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source "$__DIR/../../../build/__phpVersions.sh"
declare -r VERSION_ARRAY=($PHP73_VERSION $PHP72_VERSION)
declare -r VERSION_ARRAY_BUSTER=($PHP74_VERSION)
declare -r VERSION_ARRAY_BUSTER=($PHP74_VERSION $PHP80_VERSION)

Просмотреть файл

@ -28,7 +28,7 @@ RUN apt-get update \
&& ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
RUN set -eux; \
if [[ $PHP_VERSION == 7.4.* ]]; then \
if [[ $PHP_VERSION == 7.4.* || $PHP_VERSION == 8.0.* ]]; then \
apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends apache2-dev \
@ -66,9 +66,15 @@ RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \
sysvsem \
sysvshm \
pdo_odbc \
xmlrpc \
xsl \
&& pecl install imagick && docker-php-ext-enable imagick
# deprecated from 7.4, so should be avoided in general template for all php versions
# xmlrpc \
xsl
# https://github.com/Imagick/imagick/issues/331
RUN set -eux; \
if [[ $PHP_VERSION != 8.* ]]; then \
pecl install imagick && docker-php-ext-enable imagick; \
fi
# https://github.com/microsoft/mysqlnd_azure, Supports 7.2*, 7.3* and 7.4*
RUN set -eux; \
@ -82,7 +88,7 @@ RUN set -eux; \
# - 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 == 7.2.* || $PHP_VERSION == 7.3.* ]]; then \
if [[ $PHP_VERSION == 7.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; \
@ -106,14 +112,6 @@ RUN { \
echo 'zend_extension=opcache'; \
} > /usr/local/etc/php/conf.d/php.ini
# 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; \
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;
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \

Просмотреть файл

@ -16,12 +16,12 @@ RUN ./build.sh ruby /opt/startupcmdgen/startupcmdgen
FROM oryx-run-base-${DEBIAN_FLAVOR} AS main
ARG IMAGES_DIR=/tmp/oryx/images
ENV RUBY_VERSION 2.7.1
ENV RUBY_VERSION 2.7.2
RUN ${IMAGES_DIR}/installPlatform.sh ruby $RUBY_VERSION --dir /opt/ruby/$RUBY_VERSION --links false
RUN set -ex \
&& cd /opt/ruby/ \
&& ln -s 2.7.1 2.7 \
&& ln -s 2.7.2 2.7 \
&& ln -s 2.7 2
ENV PATH="/opt/ruby/2.7/bin:${PATH}"

Просмотреть файл

@ -101,7 +101,7 @@ echo
# make sure bundled "rubygems" is older than GEM_VERSION (https://github.com/docker-library/ruby/issues/246)
$rubyBinDir/ruby -e 'exit(Gem::Version.create(ENV["GEM_VERSION"]) > Gem::Version.create(Gem::VERSION))'; \
$rubyBinDir/gem update --system "$GEM_VERSION" && rm -r /root/.gem/; \
$rubyBinDir/gem update --system "$GEM_VERSION"; \
# verify we have no "ruby" packages installed
! dpkg -l | grep -i $rubyBinDir/ruby; \

Просмотреть файл

@ -1,4 +1,6 @@
# version, sha
3.0.0, 68bfaeef027b6ccd0032504a68ae69721a70e97d921ff328c0c8836c798f6cb1,
2.7.2, 1b95ab193cc8f5b5e59d2686cb3d5dcf1ddf2a86cb6950e0b4bdaae5040ec0d6,
2.7.1, b224f9844646cc92765df8288a46838511c1cec5b550d8874bd4686a904fcee7,
2.6.6, 5db187882b7ac34016cd48d7032e197f07e4968f406b0690e20193b9b424841f,
2.5.8, 0391b2ffad3133e274469f9953ebfd0c9f7c186238968cbdeeb0651aa02a4d6d

Просмотреть файл

@ -5,7 +5,7 @@ namespace Microsoft.Oryx.BuildScriptGenerator.Common
public static class PhpVersions
{
public const string PhpRuntimeBaseTag = "20210127.6";
public const string PhpFpmRuntimeBaseTag = "20210128.1";
public const string PhpFpmRuntimeBaseTag = "20210209.2";
public const string ComposerVersion = "1.9.3";
public const string ComposerSetupSha384 = "756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3";
public const string Composer19Version = "1.9.3";

Просмотреть файл

@ -4,9 +4,9 @@ namespace Microsoft.Oryx.BuildScriptGenerator.Common
{
public static class RubyVersions
{
public const string GemVersion = "3.1.4";
public const string Ruby27Version = "2.7.1";
public const string Ruby27TarSha256 = "b224f9844646cc92765df8288a46838511c1cec5b550d8874bd4686a904fcee7";
public const string GemVersion = "3.2.9";
public const string Ruby27Version = "2.7.2";
public const string Ruby27TarSha256 = "6e5706d0d4ee4e1e2f883db9d768586b4d06567debea353c796ec45e8321c3d4";
public const string Ruby26Version = "2.6.6";
public const string Ruby26TarSha256 = "5db187882b7ac34016cd48d7032e197f07e4968f406b0690e20193b9b424841f";
public const string Ruby25Version = "2.5.8";

Просмотреть файл

@ -22,6 +22,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]

Просмотреть файл

@ -24,6 +24,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]
@ -63,6 +64,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]

Просмотреть файл

@ -22,6 +22,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]
@ -61,6 +62,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]

Просмотреть файл

@ -23,6 +23,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]
@ -62,6 +63,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]

Просмотреть файл

@ -22,6 +22,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]
@ -60,6 +61,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3")]
[InlineData("7.2")]

Просмотреть файл

@ -25,6 +25,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory]
[InlineData("8.0-fpm")]
[InlineData("7.4-fpm")]
[InlineData("7.3")]
[InlineData("7.2")]
@ -76,6 +77,7 @@ namespace Microsoft.Oryx.Integration.Tests
}
[Theory(Skip = "#1101128, investigate why this tests are only failing in agent machines")]
[InlineData("8.0")]
[InlineData("7.4")]
[InlineData("7.3-fpm")]
[InlineData("7.2-fpm")]

Просмотреть файл

@ -40,6 +40,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
}
[Theory]
[InlineData("8.0-fpm", PhpVersions.Php80Version)]
[InlineData("7.4-fpm", PhpVersions.Php74Version)]
[InlineData("7.3-fpm", PhpVersions.Php73Version)]
[InlineData("7.2-fpm", PhpVersions.Php72Version)]
@ -63,6 +64,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
}
[Theory]
[InlineData("8.0-fpm")]
[InlineData("7.4-fpm")]
[InlineData("7.3-fpm")]
[InlineData("7.2-fpm")]
@ -110,6 +112,7 @@ namespace Microsoft.Oryx.RuntimeImage.Tests
}
[SkippableTheory]
[InlineData("8.0-fpm")]
[InlineData("7.4-fpm")]
[InlineData("7.3-fpm")]
[InlineData("7.2-fpm")]

Просмотреть файл

@ -6,7 +6,7 @@ variables:
jobs:
- template: ../templates/_buildimageBasesJobTemplate.yml
parameters:
displayName: Build php runtime base images
displayName: Build php stretch runtime base images
scriptPath: ./build/buildRunTimeImageBases.sh
imageDir: php-fpm
imageDebianFlavor: stretch
@ -15,7 +15,7 @@ jobs:
- template: ../templates/_buildimageBasesJobTemplate.yml
parameters:
displayName: Build php runtime base images
displayName: Build php buster runtime base images
scriptPath: ./build/buildRunTimeImageBases.sh
imageDir: php-fpm
imageDebianFlavor: buster