Skip to content

Commit

Permalink
Revert nginx upgrade (#2029)
Browse files Browse the repository at this point in the history
* revert nginx upgrade

* update php versions

* revert to base images generated in april

* Revert "revert to base images generated in april"

This reverts commit bb42fb5.
  • Loading branch information
pauld-msft authored Jun 30, 2023
1 parent 2eaf2fd commit 85a0340
Show file tree
Hide file tree
Showing 8 changed files with 287 additions and 69 deletions.
4 changes: 2 additions & 2 deletions build/__phpVersions.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file was auto-generated from 'constants.yaml'. Changes may be overridden.

PHP_RUNTIME_BASE_TAG='20230609.1'
PHP_FPM_RUNTIME_BASE_TAG='20230609.2'
PHP_RUNTIME_BASE_TAG='20230630.1'
PHP_FPM_RUNTIME_BASE_TAG='20230630.1'
COMPOSER_VERSION='2.0.8'
COMPOSER_SETUP_SHA384='55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae'
COMPOSER1_9_VERSION='1.9.3'
Expand Down
4 changes: 2 additions & 2 deletions build/constants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@
file-name-prefix: __
- name: php-versions
constants:
php-runtime-base-tag: 20230609.1
php-fpm-runtime-base-tag: 20230609.2
php-runtime-base-tag: 20230630.1
php-fpm-runtime-base-tag: 20230630.1
composer-version: 2.0.8
composer-setup-sha384: 55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae
composer1-9-version: 1.9.3
Expand Down
4 changes: 1 addition & 3 deletions images/runtime/php-fpm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Dockerfile
buster.Dockerfile
base.Dockerfile
base.Buster.Dockerfile
bullseye.Dockerfile
base.bullseye.Dockerfile
base.Buster.Dockerfile
137 changes: 137 additions & 0 deletions images/runtime/php-fpm/8.1/base.bullseye.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
FROM oryxdevmcr.azurecr.io/private/oryx/php-fpm-8.1
SHELL ["/bin/bash", "-c"]
ENV PHP_VERSION 8.1.18

# 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.* ]]; 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"
137 changes: 137 additions & 0 deletions images/runtime/php-fpm/8.2/base.bullseye.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
FROM oryxdevmcr.azurecr.io/private/oryx/php-fpm-8.2
SHELL ["/bin/bash", "-c"]
ENV PHP_VERSION 8.2.5

# 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.* ]]; 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"
49 changes: 0 additions & 49 deletions images/runtime/php-fpm/nginx_conf/nginx.conf

This file was deleted.

17 changes: 6 additions & 11 deletions images/runtime/php-fpm/template.base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,17 @@ 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://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#installing-prebuilt-debian-packages
# - https://www.linuxcapable.com/how-to-install-latest-nginx-mainline-or-stable-on-debian-11/
RUN apt-get update
RUN apt-get install -y --no-install-recommends curl gnupg2 ca-certificates lsb-release debian-archive-keyring
RUN curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \
| tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
RUN echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/debian `lsb_release -cs` nginx" \
| tee /etc/apt/sources.list.d/nginx.list
RUN echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
| tee /etc/apt/preferences.d/99nginx
RUN apt install curl nano -y
RUN curl -sSL https://packages.sury.org/nginx/README.txt | bash -x
RUN apt-get update
RUN apt-get install -y --no-install-recommends nginx
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
COPY images/runtime/php-fpm/nginx_conf/nginx.conf /etc/nginx/nginx.conf
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
Expand Down
4 changes: 2 additions & 2 deletions src/BuildScriptGenerator/PhpVersions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace Microsoft.Oryx.BuildScriptGenerator.Common
{
public static class PhpVersions
{
public const string PhpRuntimeBaseTag = "20230609.1";
public const string PhpFpmRuntimeBaseTag = "20230609.2";
public const string PhpRuntimeBaseTag = "20230630.1";
public const string PhpFpmRuntimeBaseTag = "20230630.1";
public const string ComposerVersion = "2.0.8";
public const string ComposerSetupSha384 = "55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae";
public const string Composer19Version = "1.9.3";
Expand Down

0 comments on commit 85a0340

Please sign in to comment.