Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 8.2 support #192

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- "7.4-alpine"
- "8.0"
- "8.1"
- "8.2"
platform:
- linux/amd64
- linux/arm64
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- Dockerfile: Dockerfile-8.1
version: "8.1"
platforms: linux/amd64,linux/arm64
- Dockerfile: Dockerfile-8.2
version: "8.2"
platforms: linux/amd64,linux/arm64
steps:
-
name: Checkout
Expand Down
145 changes: 145 additions & 0 deletions Dockerfile-8.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
FROM behance/docker-nginx:10.2.0 as output
LABEL maintainers="Behance Team <[email protected]>"

# Set TERM to suppress warning messages.
ENV CONF_PHPFPM=/etc/php/8.2/fpm/php-fpm.conf \
CONF_PHPMODS=/etc/php/8.2/mods-available \
CONF_FPMPOOL=/etc/php/8.2/fpm/pool.d/www.conf \
CONF_FPMOVERRIDES=/etc/php/8.2/fpm/conf.d/overrides.user.ini \
APP_ROOT=/app \
SERVER_WORKER_CONNECTIONS=3072 \
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
SERVER_CLIENT_HEADER_BUFFER_SIZE=1k \
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
SERVER_LARGE_CLIENT_HEADER_BUFFERS="4 256k" \
PHP_FPM_MAX_CHILDREN=4096 \
PHP_FPM_START_SERVERS=20 \
PHP_FPM_MAX_REQUESTS=1024 \
PHP_FPM_MIN_SPARE_SERVERS=5 \
PHP_FPM_MAX_SPARE_SERVERS=128 \
PHP_FPM_MEMORY_LIMIT=256M \
PHP_FPM_MAX_EXECUTION_TIME=60 \
PHP_FPM_UPLOAD_MAX_FILESIZE=1M \
PHP_OPCACHE_MEMORY_CONSUMPTION=128 \
PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16 \
PHP_OPCACHE_MAX_WASTED_PERCENTAGE=5 \
PHP_OPCACHE_ENABLE_CLI=1 \
PHP_ENGINE_VERSION=20210902 \
CFG_APP_DEBUG=1

COPY ./scripts/ /scripts/

# - Update security packages
# - Add PHP and support packages
# - Install NewRelic
# - Compile extensions
# - Enable/disable default extensions
# - Cleanup
RUN /bin/bash -e /security_updates.sh && \
apt-get install -yqq --no-install-recommends \
gpg-agent \
git \
curl \
wget \
software-properties-common \
locales \
&& \
locale-gen en_US.UTF-8 && export LANG=en_US.UTF-8 && \
add-apt-repository ppa:ondrej/php -y && \
apt-get update -q && \
# Ensure old versions of PHP don't accidentally get added by PPA maintainers
apt-mark hold \
manpages \
manpages-dev \
apache2 \
apache2-bin \
libapache2-mod-php8.2 \
&& \
apt-get -yqq install \
php8.2 \
php8.2-apcu \
php8.2-bcmath \
php8.2-bz2 \
php8.2-curl \
php8.2-fpm \
php8.2-gd \
php8.2-intl \
php8.2-mbstring \
php8.2-memcache \
php8.2-memcached \
php8.2-mysql \
php8.2-pgsql \
php8.2-redis \
php8.2-xdebug \
php8.2-xml \
php8.2-yaml \
php8.2-zip \
# below required to compile non-packaged extensions
php8.2-dev \
pkg-config \
libmemcached-dev \
zlib1g-dev \
libssl-dev \
libpcre3-dev \
golang \
&& \
/bin/bash -e /scripts/install-newrelic-ubuntu.sh && \
/bin/bash -e /scripts/install-composer.sh && \
phpenmod \
memcached \
igbinary \
msgpack \
&& \
phpdismod \
pdo_pgsql \
pgsql \
redis \
yaml \
xdebug \
&& \
apt-get remove --purge -yq \
build-essential \
cpp \
cpp-7 \
gcc \
golang \
libpcre3-dev \
libssl-dev \
locales \
patch \
php8.2-dev \
pkg-config \
software-properties-common \
wget \
&& \
/bin/bash /clean.sh \
# Remove extra extensions installed via packages for other versions of PHP, leaving the active engine folder
cd /usr/lib/php && \
ls -d */ | grep '[0-9]\{8\}' | grep -v ${PHP_ENGINE_VERSION} | xargs rm -rf && \
cd /

# Overlay the root filesystem from this repo
COPY ./container/root /

# - Make additional hacks to migrate files/config from 7.0 --> 8.2 folder
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
cp /etc/php/7.0/fpm/conf.d/overrides.user.ini $CONF_FPMOVERRIDES && \
# Hack: share startup scripts between variant versions by symlinking \
ln -s /usr/sbin/php-fpm8.2 /usr/sbin/php-fpm && \
# Override default ini values for both CLI + FPM \
phpenmod overrides && \
# Enable NewRelic via Ubuntu symlinks, but disable in file. Cross-variant startup script uncomments with env vars.
phpenmod newrelic && \
# Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
/bin/bash -e /scripts/prep-php.sh

# TESTING PHASE: using multi-stage to isolate any possible side effects
FROM output as testenvironment

# HACK: workaround for https://github.com/aelsabbahy/goss/issues/392
# Run the child and parent test configs separately instead of leveraging inheritance
RUN goss -g /tests/php-fpm/8.2.goss.yaml validate && \
goss -g /tests/php-fpm/base.goss.yaml validate

# Output the final image
FROM output
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ Available on [Docker Hub](https://hub.docker.com/r/behance/docker-php/).
### Quick-start

- `docker run behance/docker-php:7.4-alpine "php" "-v"`
- `docker run behance/docker-php:7.4" "php" "-v"`
- `docker run behance/docker-php:8.0" "php" "-v"`
- `docker run behance/docker-php:7.4 "php" "-v"`
- `docker run behance/docker-php:8.0 "php" "-v"`
- `docker run behance/docker-php:8.1 "php" "-v"`
- `docker run behance/docker-php:8.2 "php" "-v"`

Adding code to runtime, see [here](https://github.com/behance/docker-php#expectations).
PHP tuning and configuration, see [here](https://github.com/behance/docker-php#downstream-configuration).
Expand Down
22 changes: 22 additions & 0 deletions container/root/tests/php-fpm/8.2.goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

# Extended file tests will be overridden/ignored from parent
# Note: Other variants may not include extended file tests, are not susceptible
# @see https://github.com/aelsabbahy/goss/issues/392

# gossfile:
# base.goss.yaml: {}

command:
# IMPORTANT: confirm the major/minor version of PHP itself
php -r 'echo PHP_MAJOR_VERSION;':
exit-status: 0
stdout: [8]
php -r 'echo PHP_MINOR_VERSION;':
exit-status: 0
stdout: [2]
php-fpm -v:
exit-status: 0
stdout: [PHP 8.2]
# Not common to all variants, test in supported children
php -m | grep -i memcache:
exit-status: 0
Loading