forked from webdevops/Dockerfile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hans Tuscher
committed
Nov 29, 2023
1 parent
77195db
commit b550a15
Showing
386 changed files
with
8,140 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() }} |
1 change: 1 addition & 0 deletions
1
docker/php-apache-dev/8.3-alpine/conf/bin/service.d/blackfire-agent.d/10-init.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# placeholder |
25 changes: 25 additions & 0 deletions
25
docker/php-apache-dev/8.3-alpine/conf/bin/service.d/blackfire-agent.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
8 changes: 8 additions & 0 deletions
8
docker/php-apache-dev/8.3-alpine/conf/etc/httpd/conf.d/02-dev.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
10 changes: 10 additions & 0 deletions
10
docker/php-apache-dev/8.3-alpine/conf/etc/httpd/vhost.common.d/02-dev.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
14 changes: 14 additions & 0 deletions
14
docker/php-apache-dev/8.3-alpine/conf/etc/supervisor.d/blackfire-agent.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
24 changes: 24 additions & 0 deletions
24
docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
6 changes: 6 additions & 0 deletions
6
docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
11 changes: 11 additions & 0 deletions
11
docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
33 changes: 33 additions & 0 deletions
33
docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-xdebug.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
106 changes: 106 additions & 0 deletions
106
docker/php-apache-dev/8.3-alpine/conf/provision/entrypoint.d/10-php-debugger.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
5 changes: 5 additions & 0 deletions
5
docker/php-apache-dev/8.3-alpine/conf/provision/entrypoint.d/20-apache-dev.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() }} |
1 change: 1 addition & 0 deletions
1
docker/php-apache-dev/8.3/conf/bin/service.d/blackfire-agent.d/10-init.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# placeholder |
25 changes: 25 additions & 0 deletions
25
docker/php-apache-dev/8.3/conf/bin/service.d/blackfire-agent.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.