Skip to content

Commit

Permalink
php 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Tuscher committed Nov 29, 2023
1 parent 77195db commit b550a15
Show file tree
Hide file tree
Showing 386 changed files with 8,140 additions and 59 deletions.
4 changes: 4 additions & 0 deletions conf/console.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ dockerTest:
OS_FAMILY: 'debian'
OS_VERSION: '9'
PHP_OFFICIAL: '1'
'php:8:3$':
OS_FAMILY: 'debian'
OS_VERSION: '12'
PHP_OFFICIAL: '1'
'php[^:]*:[0-9]':
OS_FAMILY: 'debian'
OS_VERSION: '10'
Expand Down
39 changes: 39 additions & 0 deletions docker/php-apache-dev/8.3-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#+++++++++++++++++++++++++++++++++++++++
# Dockerfile for webdevops/php-apache-dev:8.3-alpine
# -- automatically generated --
#+++++++++++++++++++++++++++++++++++++++

FROM webdevops/php-apache:8.3-alpine

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 set -x \
# Install development environment
&& bash -c "$(curl -L https://installer.blackfire.io/installer.sh)" \
&& blackfire php:install \
&& apk-install \
linux-headers \
make \
autoconf \
g++ \
&& pecl install xdebug \
&& apk del -f --purge \
autoconf \
linux-headers \
g++ \
make \
&& docker-php-ext-enable xdebug \
# Enable php development services
&& docker-service enable syslog \
&& docker-service enable postfix \
&& docker-service enable ssh \
&& docker-run-bootstrap \
&& docker-image-cleanup
12 changes: 12 additions & 0 deletions docker/php-apache-dev/8.3-alpine/Dockerfile.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{ docker.from("php-apache", "8.3-alpine") }}

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

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

RUN set -x \
{{ php.officialDevelopmentAlpine(version="8.3") }} \
{{ provision.runBootstrap() }} \
{{ docker.cleanup() }}
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,24 @@
#!/usr/bin/env bash

PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1)

# 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

if [[ "$(version-compare "$PHP_VERSION" "5.5.999")" == "<" ]]; then
# listen on public IPv4 port
# no ipv6 sockets available for old php version
go-replace --mode=line --regex \
-s '^[\s;]*listen[\s]*=' -r 'listen = 0.0.0.0:9000' \
-- /opt/docker/etc/php/fpm/pool.d/application.conf \
/opt/docker/etc/php/fpm/php-fpm.conf
else
# listen on public IPv6 port
go-replace --mode=line --regex \
-s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \
-- /opt/docker/etc/php/fpm/pool.d/application.conf \
/opt/docker/etc/php/fpm/php-fpm.conf

fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

# Disable blackfire by default
rm -f \
/etc/php5/cli/conf.d/zz-blackfire.ini \
/etc/php5/fpm/conf.d/zz-blackfire.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/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' \
-s '^[\s;]*opcache.fast_shutdown[\s]*=' -r 'opcache.fast_shutdown = 1' \
-- /opt/docker/etc/php/php.webdevops.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

IMAGE_FAMILY=$(docker-image-info family)

case "$IMAGE_FAMILY" in
Alpine)
# Fix php xdebug module [Alpine family]

if [[ -f "/etc/php5/conf.d/xdebug.ini" ]]; then
go-replace --mode=lineinfile \
-s '^extension=xdebug.so' -r 'zend_extension=xdebug.so' \
/etc/php5/conf.d/xdebug.ini
fi

if [[ -f "/etc/php7/conf.d/xdebug.ini" ]]; then
go-replace --mode=lineinfile \
-s '^extension=xdebug.so' -r 'zend_extension=xdebug.so' \
/etc/php7/conf.d/xdebug.ini
fi

;;
esac

# 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,106 @@
#!/usr/bin/env bash

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

PHP_CONF_PATHS="
/etc/php5/conf.d
/etc/php7/conf.d
/etc/php.d
/etc/php5/mods-available
/etc/php5/cli/conf.d
/etc/php5/cli/conf.d
/etc/php5/fpm/conf.d
/etc/php5/fpm/conf.d
/etc/php/7.0/mods-available
/etc/php/7.1/mods-available
/etc/php/7.2/mods-available
/etc/php/7.3/mods-available
/etc/php/7.4/mods-available
/etc/php/7.0/cli/conf.d
/etc/php/7.1/cli/conf.d
/etc/php/7.2/cli/conf.d
/etc/php/7.3/cli/conf.d
/etc/php/7.4/cli/conf.d
/etc/php/7.0/fpm/conf.d
/etc/php/7.1/fpm/conf.d
/etc/php/7.2/fpm/conf.d
/etc/php/7.3/fpm/conf.d
/etc/php/7.4/fpm/conf.d
/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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go-replace \
-s "<WEB_NO_CACHE_PATTERN>" -r "$WEB_NO_CACHE_PATTERN" \
--path=/opt/docker/etc/httpd/ \
--path-pattern='*.conf' \
--ignore-empty
32 changes: 32 additions & 0 deletions docker/php-apache-dev/8.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#+++++++++++++++++++++++++++++++++++++++
# Dockerfile for webdevops/php-apache-dev:8.3
# -- automatically generated --
#+++++++++++++++++++++++++++++++++++++++

FROM webdevops/php-apache:8.3

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 set -x \
# Install development environment
&& 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 - \
&& apt-install tideways-php tideways-daemon \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
# Enable php development services
&& docker-service enable syslog \
&& docker-service enable postfix \
&& docker-service enable ssh \
&& docker-run-bootstrap \
&& docker-image-cleanup
12 changes: 12 additions & 0 deletions docker/php-apache-dev/8.3/Dockerfile.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{ docker.from("php-apache", "8.3") }}

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

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

RUN set -x \
{{ php.officialDevelopment(version="8.3") }} \
{{ provision.runBootstrap() }} \
{{ docker.cleanup() }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# placeholder
25 changes: 25 additions & 0 deletions docker/php-apache-dev/8.3/conf/bin/service.d/blackfire-agent.sh
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
Loading

0 comments on commit b550a15

Please sign in to comment.