Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,844 changes: 1,686 additions & 158 deletions .github/workflows/build.yaml

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ controls extension loading. PIE requests remain unpinned, and compilation uses
`nproc` parallel jobs.

Protobuf, Vips and XML-RPC are built directly from their official upstream sources.
The existing XML-RPC **1.0.0RC3** pin is preserved on all supported PHP versions.
Protobuf on PHP 8.2–8.5 uses the latest upstream release. If a future release raises its minimum PHP
Vips and XML-RPC are only built for PHP 8.2–8.5 (see [PHP 8.6](docs/images/php.md#php-86-preview)).
The existing XML-RPC **1.0.0RC3** pin is preserved on those versions.
Protobuf on PHP 8.2–8.6 uses the latest upstream release. If a future release raises its minimum PHP
version, older PHP image builds can fail; there is no automatic fallback to an
older release. The existing CI matrix checks compatibility across PHP versions.

Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,59 +55,73 @@ How the files in this repository are generated, and how the images are built and

### Debian PHP

The following images which are currently supported are based on `php:{VER}-fpm-bookworm`.
The following images which are currently supported are based on `php:{VER}-fpm-bookworm`
(PHP 8.6: `php:8.6-rc-fpm-trixie`, a preview, see [PHP 8.6](docs/images/php.md#php-86-preview)).

* `webdevops/php:8.2`
* `webdevops/php:8.3`
* `webdevops/php:8.4`
* `webdevops/php:8.5`
* `webdevops/php:8.6` (preview)
* `webdevops/php-dev:8.2`
* `webdevops/php-dev:8.3`
* `webdevops/php-dev:8.4`
* `webdevops/php-dev:8.5`
* `webdevops/php-dev:8.6` (preview)
* `webdevops/php-apache:8.2`
* `webdevops/php-apache:8.3`
* `webdevops/php-apache:8.4`
* `webdevops/php-apache:8.5`
* `webdevops/php-apache:8.6` (preview)
* `webdevops/php-apache-dev:8.2`
* `webdevops/php-apache-dev:8.3`
* `webdevops/php-apache-dev:8.4`
* `webdevops/php-apache-dev:8.5`
* `webdevops/php-apache-dev:8.6` (preview)
* `webdevops/php-nginx:8.2`
* `webdevops/php-nginx:8.3`
* `webdevops/php-nginx:8.4`
* `webdevops/php-nginx:8.5`
* `webdevops/php-nginx:8.6` (preview)
* `webdevops/php-nginx-dev:8.2`
* `webdevops/php-nginx-dev:8.3`
* `webdevops/php-nginx-dev:8.4`
* `webdevops/php-nginx-dev:8.5`
* `webdevops/php-nginx-dev:8.6` (preview)


### Alpine PHP

The following images which are currently supported are based on `php:{VER}-fpm-alpine`.
The following images which are currently supported are based on `php:{VER}-fpm-alpine`
(PHP 8.6: `php:8.6-rc-fpm-alpine`, a preview, see [PHP 8.6](docs/images/php.md#php-86-preview)).

* `webdevops/php:8.2-alpine`
* `webdevops/php:8.3-alpine`
* `webdevops/php:8.4-alpine`
* `webdevops/php:8.5-alpine`
* `webdevops/php:8.6-alpine` (preview)
* `webdevops/php-dev:8.2-alpine`
* `webdevops/php-dev:8.3-alpine`
* `webdevops/php-dev:8.4-alpine`
* `webdevops/php-dev:8.5-alpine`
* `webdevops/php-dev:8.6-alpine` (preview)
* `webdevops/php-apache:8.2-alpine`
* `webdevops/php-apache:8.3-alpine`
* `webdevops/php-apache:8.4-alpine`
* `webdevops/php-apache:8.5-alpine`
* `webdevops/php-apache:8.6-alpine` (preview)
* `webdevops/php-apache-dev:8.2-alpine`
* `webdevops/php-apache-dev:8.3-alpine`
* `webdevops/php-apache-dev:8.4-alpine`
* `webdevops/php-apache-dev:8.5-alpine`
* `webdevops/php-apache-dev:8.6-alpine` (preview)
* `webdevops/php-nginx:8.2-alpine`
* `webdevops/php-nginx:8.3-alpine`
* `webdevops/php-nginx:8.4-alpine`
* `webdevops/php-nginx:8.5-alpine`
* `webdevops/php-nginx:8.6-alpine` (preview)
* `webdevops/php-nginx-dev:8.2-alpine`
* `webdevops/php-nginx-dev:8.3-alpine`
* `webdevops/php-nginx-dev:8.4-alpine`
* `webdevops/php-nginx-dev:8.5-alpine`
* `webdevops/php-nginx-dev:8.6-alpine` (preview)
4 changes: 4 additions & 0 deletions conf/console.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ dockerTest:
OS_FAMILY: 'debian'
OS_VERSION: '12'
PHP_OFFICIAL: '1'
'php[^:]*:8.6$':
OS_FAMILY: 'debian'
OS_VERSION: '13'
PHP_OFFICIAL: '1'
5 changes: 3 additions & 2 deletions docker/php-apache-dev/8.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin
# Install development environment
&& BLACKFIRE_INSTALL_METHOD=raw bash -c "$(curl -L https://installer.blackfire.io/installer.sh)" \
&& blackfire php:install \
&& echo 'deb https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list \
&& wget -qO - https://packages.tideways.com/key.gpg | apt-key add - \
&& install -d -m 0755 /etc/apt/keyrings \
&& curl -fsSL --proto '=https' --proto-redir '=https' --retry 3 https://packages.tideways.com/key.gpg -o /etc/apt/keyrings/tideways.asc \
&& echo 'deb [signed-by=/etc/apt/keyrings/tideways.asc] https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list \
&& apt-install tideways-php tideways-daemon \
&& PIE_WORKING_DIRECTORY=/tmp/pie pie install --no-interaction --no-cache \
--skip-enable-extension --make-parallel-jobs="$(nproc)" xdebug/xdebug \
Expand Down
5 changes: 3 additions & 2 deletions docker/php-apache-dev/8.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin
# Install development environment
&& BLACKFIRE_INSTALL_METHOD=raw bash -c "$(curl -L https://installer.blackfire.io/installer.sh)" \
&& blackfire php:install \
&& echo 'deb https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list \
&& wget -qO - https://packages.tideways.com/key.gpg | apt-key add - \
&& install -d -m 0755 /etc/apt/keyrings \
&& curl -fsSL --proto '=https' --proto-redir '=https' --retry 3 https://packages.tideways.com/key.gpg -o /etc/apt/keyrings/tideways.asc \
&& echo 'deb [signed-by=/etc/apt/keyrings/tideways.asc] https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list \
&& apt-install tideways-php tideways-daemon \
&& PIE_WORKING_DIRECTORY=/tmp/pie pie install --no-interaction --no-cache \
--skip-enable-extension --make-parallel-jobs="$(nproc)" xdebug/xdebug \
Expand Down
5 changes: 3 additions & 2 deletions docker/php-apache-dev/8.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin
# Install development environment
&& BLACKFIRE_INSTALL_METHOD=raw bash -c "$(curl -L https://installer.blackfire.io/installer.sh)" \
&& blackfire php:install \
&& echo 'deb https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list \
&& wget -qO - https://packages.tideways.com/key.gpg | apt-key add - \
&& install -d -m 0755 /etc/apt/keyrings \
&& curl -fsSL --proto '=https' --proto-redir '=https' --retry 3 https://packages.tideways.com/key.gpg -o /etc/apt/keyrings/tideways.asc \
&& echo 'deb [signed-by=/etc/apt/keyrings/tideways.asc] https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list \
&& apt-install tideways-php tideways-daemon \
&& PIE_WORKING_DIRECTORY=/tmp/pie pie install --no-interaction --no-cache \
--skip-enable-extension --make-parallel-jobs="$(nproc)" xdebug/xdebug \
Expand Down
5 changes: 3 additions & 2 deletions docker/php-apache-dev/8.5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin
# Install development environment
&& BLACKFIRE_INSTALL_METHOD=raw bash -c "$(curl -L https://installer.blackfire.io/installer.sh)" \
&& blackfire php:install \
&& echo 'deb https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list \
&& wget -qO - https://packages.tideways.com/key.gpg | apt-key add - \
&& install -d -m 0755 /etc/apt/keyrings \
&& curl -fsSL --proto '=https' --proto-redir '=https' --retry 3 https://packages.tideways.com/key.gpg -o /etc/apt/keyrings/tideways.asc \
&& echo 'deb [signed-by=/etc/apt/keyrings/tideways.asc] https://packages.tideways.com/apt-packages-main any-version main' | tee /etc/apt/sources.list.d/tideways.list \
&& apt-install tideways-php tideways-daemon \
&& PIE_WORKING_DIRECTORY=/tmp/pie pie install --no-interaction --no-cache \
--skip-enable-extension --make-parallel-jobs="$(nproc)" xdebug/xdebug \
Expand Down
51 changes: 51 additions & 0 deletions docker/php-apache-dev/8.6-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#+++++++++++++++++++++++++++++++++++++++
# Dockerfile for webdevops/php-apache-dev:8.6-alpine
# -- automatically generated --
#+++++++++++++++++++++++++++++++++++++++

FROM webdevops/php-apache:8.6-alpine

Check notice

Code scanning / SonarCloud

Docker containers should not run as a privileged user Low

This image might run with "root" as the default user. Make sure it is safe here. See more on SonarQube Cloud

ENV WEB_DOCUMENT_ROOT=/app \
WEB_DOCUMENT_INDEX=index.php \
WEB_ALIAS_DOMAIN=*.vm \
WEB_PHP_TIMEOUT=600 \
WEB_PHP_SOCKET=""
ENV WEB_PHP_SOCKET=127.0.0.1:9000
ENV WEB_NO_CACHE_PATTERN="\.(css|js|gif|png|jpg|svg|json|xml)$"

COPY conf/ /opt/docker/

RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
set -x \
# Install development environment
&& bash -c "$(curl -L https://installer.blackfire.io/installer.sh)" \

Check warning on line 21 in docker/php-apache-dev/8.6-alpine/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Not enforcing HTTPS here might allow for redirections to insecure websites. Make sure it is safe here.

See more on https://sonarcloud.io/project/issues?id=webdevops_Dockerfile&issues=AaGwT4LlBxEszC6s-R8E&open=AaGwT4LlBxEszC6s-R8E&pullRequest=594

Check failure

Code scanning / SonarCloud

Avoid executing downloaded artifacts without verification High

Avoid executing downloaded artifacts directly without verification. See more on SonarQube Cloud

Check warning

Code scanning / SonarCloud

HTTPS should be enforced on HTTP clients following redirects Medium

Not enforcing HTTPS here might allow for redirections to insecure websites. Make sure it is safe here. See more on SonarQube Cloud
# TODO PHP 8.6: `blackfire php:install` installs the glibc probe on Alpine with ZTS;
# install the Alpine probe directly
&& mkdir -p /tmp/blackfire \
&& curl -fsSL --proto '=https' --proto-redir '=https' --retry 3 "https://blackfire.io/api/v1/releases/probe/php/alpine/$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')/86-zts" | tar xz -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire-*.so "$(php -r 'echo ini_get("extension_dir");')/blackfire.so" \
&& printf '[blackfire]\nextension=blackfire.so\n' > /usr/local/etc/php/conf.d/99-blackfire.ini \
&& rm -rf /tmp/blackfire \
&& apk-install \
linux-headers \
make \
autoconf \
g++ \
libtool \
pkgconf \
&& PIE_WORKING_DIRECTORY=/tmp/pie pie install --no-interaction --no-cache \
--skip-enable-extension --make-parallel-jobs="$(nproc)" "xdebug/xdebug:^3.6@alpha" \
&& rm -rf /tmp/pie \
&& apk del -f --purge \
autoconf \
linux-headers \
g++ \
make \
libtool \
pkgconf \
&& docker-php-ext-enable xdebug \
# Enable php development services
&& docker-service enable syslog \
&& docker-service enable postfix \
&& docker-service enable ssh \
&& docker-run-bootstrap
16 changes: 16 additions & 0 deletions docker/php-apache-dev/8.6-alpine/Dockerfile.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% import 'docker.twig' as docker %}
{% import 'provision.twig' as provision %}
{% import 'environment.twig' as environment %}
{% import 'images/php.twig' as php %}
{{ docker.from("php-apache", "8.6-alpine") }}

{{ environment.web() }}
{{ environment.webPhp() }}
{{ environment.webDevelopment() }}

{{ docker.copy('conf/', '/opt/docker/') }}

RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
set -x \
{{ php.officialDevelopmentAlpine(version="8.6") }} \
{{ provision.runBootstrap() }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# placeholder
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

# Init vars
if [[ -z "$SERVICE_BLACKFIRE_AGENT_OPTS" ]]; then SERVICE_BLACKFIRE_AGENT_OPTS=""; fi

source /opt/docker/bin/config.sh

BLACKFIRE_ARGS=""

includeScriptDir "/opt/docker/bin/service.d/syslog-ng.d/"

# blackfire.server_id
if [[ -n "${BLACKFIRE_SERVER_ID+x}" ]]; then
BLACKFIRE_ARGS="$BLACKFIRE_ARGS --server-id=\"${BLACKFIRE_SERVER_ID}\""
fi

# blackfire.server_token
if [[ -n "${BLACKFIRE_SERVER_TOKEN+x}" ]]; then
BLACKFIRE_ARGS="$BLACKFIRE_ARGS --server-token=\"${BLACKFIRE_SERVER_TOKEN}\""
fi

# create directory for unix socket
mkdir -p /var/run/blackfire

eval exec blackfire-agent $BLACKFIRE_ARGS $SERVICE_BLACKFIRE_AGENT_OPTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
EnableSendfile off

LogLevel info
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<FilesMatch "<WEB_NO_CACHE_PATTERN>">
FileETag None

<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</FilesMatch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[group:blackfire-agent]
programs=blackfire-agentd
priority=25

[program:blackfire-agentd]
command = /opt/docker/bin/service.d/blackfire-agent.sh
process_name=%(program_name)s
startsecs = 0
autostart = false
autorestart = true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# Configure php-fpm
go-replace --mode=lineinfile --regex \
-s '^[\s;]*access.format[\s]*=' -r 'access.format = "%R - %u %t \"%m %r%Q%q\" %s %f cpu:%C%% mem:%{megabytes}M reqTime:%d"' \
-- /opt/docker/etc/php/fpm/pool.d/application.conf

# Listen on port 9000 of all addresses: PHP-FPM binds to [::] (IPv6 and IPv4)
# and falls back to 0.0.0.0 if the container has no IPv6
go-replace --mode=line --regex \
-s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \
--path=/opt/docker/etc/php/fpm/ \
--path-pattern='*.conf'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# Configure opcache for development
go-replace --mode=lineinfile --regex \
-s '^[\s;]*opcache.memory_consumption[\s]*=' -r 'opcache.memory_consumption = 256' \
-s '^[\s;]*opcache.validate_timestamps[\s]*=' -r 'opcache.validate_timestamps = 1' \
-s '^[\s;]*opcache.revalidate_freq[\s]*=' -r 'opcache.revalidate_freq = 0' \
-s '^[\s;]*opcache.interned_strings_buffer[\s]*=' -r 'opcache.interned_strings_buffer = 16' \
-s '^[\s;]*opcache.max_accelerated_files[\s]*=' -r 'opcache.max_accelerated_files = 7963' \
-- /opt/docker/etc/php/php.webdevops.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

# Configure xdebug for development
go-replace --mode=lineinfile --regex \
-s '^[\s;]*xdebug.mode[\s]*=' -r 'xdebug.mode = debug' \
-s '^[\s;]*xdebug.discover_client_host[\s]*=' -r 'xdebug.discover_client_host = 1' \
-s '^[\s;]*xdebug.idekey[\s]*=' -r 'xdebug.idekey = docker' \
-s '^[\s;]*xdebug.cli_color[\s]*=' -r 'xdebug.cli_color = 1' \
-s '^[\s;]*xdebug.max_nesting_level[\s]*=' -r 'xdebug.max_nesting_level = 1000' \
-s '^[\s;]*xdebug.start_with_request[\s]*=' -r 'xdebug.start_with_request = trigger' \
-s '^[\s;]*xdebug.output_dir[\s]*=' -r 'xdebug.output_dir = /tmp/debug' \
-- /opt/docker/etc/php/php.webdevops.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env bash

#################################################
# Debugger switch
#################################################

PHP_CONF_PATHS="/usr/local/etc/php/conf.d/"

function phpModuleRemove() {
if [ "$#" -ne 1 ]; then
echo "You must specify the name of the PHP module which you want to disable"
exit 1
fi

echo " - Removing PHP module ${1}"
for CONF_PATH in $PHP_CONF_PATHS; do
rm -f "${CONF_PATH}"/*"${1}".ini
done
}


if [[ -n "${PHP_DEBUGGER+x}" ]]; then
case "$PHP_DEBUGGER" in
xdebug)
echo "PHP-Debugger: Xdebug enabled"
phpModuleRemove "blackfire"
;;

blackfire)
echo "PHP-Debugger: Blackfire enabled"
phpModuleRemove "xdebug"
docker-service-enable blackfire-agent
;;

none)
echo "PHP-Debugger: none"
phpModuleRemove "blackfire"
phpModuleRemove "xdebug"
;;
esac

else

echo "PHP-Debugger: not specified - default is xdebug"
phpModuleRemove "blackfire"

fi

#################################################
# PHP debugger environment variables
#################################################

function phpEnvironmentVariable() {
PHP_INI_KEY="$1"
PHP_ENV_NAME="$2"

if [[ -n "${!PHP_ENV_NAME+x}" ]]; then
PHP_ENV_VALUE="${!PHP_ENV_NAME}"
echo "${PHP_INI_KEY}=\"${PHP_ENV_VALUE}\"" >> /opt/docker/etc/php/php.ini
fi
}

###################
# XDEBUG
###################

# xdebug3 remote debugger
phpEnvironmentVariable "xdebug.discover_client_host" "XDEBUG_DISCOVER_CLIENT_HOST"
phpEnvironmentVariable "xdebug.mode" "XDEBUG_MODE"
phpEnvironmentVariable "xdebug.start_with_request" "XDEBUG_START_WITH_REQUEST"
phpEnvironmentVariable "xdebug.client_host" "XDEBUG_CLIENT_HOST"
phpEnvironmentVariable "xdebug.client_port" "XDEBUG_CLIENT_PORT"

# xdebug3 profiler
phpEnvironmentVariable "xdebug.trigger_value" "XDEBUG_TRIGGER_VALUE"
phpEnvironmentVariable "xdebug.output_dir" "XDEBUG_OUTPUT_DIR"

###################
# BLACKFIRE
###################
phpEnvironmentVariable "blackfire.server_id" "BLACKFIRE_SERVER_ID"
phpEnvironmentVariable "blackfire.server_token" "BLACKFIRE_SERVER_TOKEN"
Loading
Loading