Skip to content
Open
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
  •  
  •  
  •  
610 changes: 439 additions & 171 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ config files from the `provisioning` directory.
We generate a multi stage Gitlab-CI configuration using PHP:

```
docker run --rm -ti -v $PWD:/app -w /app/ci webdevops/php:8.3-alpine composer install
docker run --rm -ti -v $PWD:/app -w /app webdevops/php:8.3-alpine ci/console gitlab:generate
docker run --rm -ti -v $PWD:/app -w /app/ci webdevops/php:8.4-alpine composer install
docker run --rm -ti -v $PWD:/app -w /app webdevops/php:8.4-alpine ci/console gitlab:generate
```

Gitlab CI builds every image independent and runs serverspec and structure tests on every
Expand All @@ -69,31 +69,37 @@ The following images which are currently supported are based on `php:{VER}-fpm-b
* `webdevops/php:8.2`
* `webdevops/php:8.3`
* `webdevops/php:8.4`
* `webdevops/php:8.5`
* `webdevops/php-dev:8.0`
* `webdevops/php-dev:8.1`
* `webdevops/php-dev:8.2`
* `webdevops/php-dev:8.3`
* `webdevops/php-dev:8.4`
* `webdevops/php-dev:8.5`
* `webdevops/php-apache:8.0`
* `webdevops/php-apache:8.1`
* `webdevops/php-apache:8.2`
* `webdevops/php-apache:8.3`
* `webdevops/php-apache:8.4`
* `webdevops/php-apache:8.5`
* `webdevops/php-apache-dev:8.0`
* `webdevops/php-apache-dev:8.1`
* `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-nginx:8.0`
* `webdevops/php-nginx:8.1`
* `webdevops/php-nginx:8.2`
* `webdevops/php-nginx:8.3`
* `webdevops/php-nginx:8.4`
* `webdevops/php-nginx:8.5`
* `webdevops/php-nginx-dev:8.0`
* `webdevops/php-nginx-dev:8.1`
* `webdevops/php-nginx-dev:8.2`
* `webdevops/php-nginx-dev:8.3`
* `webdevops/php-nginx-dev:8.4`
* `webdevops/php-nginx-dev:8.5`


### Alpine PHP
Expand All @@ -105,28 +111,34 @@ The following images which are currently supported are based on `php:{VER}-fpm-a
* `webdevops/php:8.2-alpine`
* `webdevops/php:8.3-alpine`
* `webdevops/php:8.4-alpine`
* `webdevops/php:8.5-alpine`
* `webdevops/php-dev:8.0-alpine`
* `webdevops/php-dev:8.1-alpine`
* `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-apache:8.0-alpine`
* `webdevops/php-apache:8.1-alpine`
* `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-dev:8.0-alpine`
* `webdevops/php-apache-dev:8.1-alpine`
* `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-nginx:8.0-alpine`
* `webdevops/php-nginx:8.1-alpine`
* `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-dev:8.0-alpine`
* `webdevops/php-nginx-dev:8.1-alpine`
* `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`
2 changes: 1 addition & 1 deletion build-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -exuo pipefail

ROOT_DIR=$(pwd)
PHP_VERSION=8.4
PHP_VERSION=8.5

#docker run --rm -ti -v $PWD:/app -w /app webdevops/dockerfile-build-env make provision

Expand Down
2 changes: 1 addition & 1 deletion conf/console.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dockerTest:
OS_FAMILY: 'debian'
OS_VERSION: '9'
PHP_OFFICIAL: '1'
'php[^:]*:8.(0|1|2|3|4)':
'php[^:]*:8.(0|1|2|3|4|5)':
OS_FAMILY: 'debian'
OS_VERSION: '12'
PHP_OFFICIAL: '1'
41 changes: 41 additions & 0 deletions docker/php-apache-dev/8.5-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#+++++++++++++++++++++++++++++++++++++++
# Dockerfile for webdevops/php-apache-dev:8.5-alpine
# -- automatically generated --
#+++++++++++++++++++++++++++++++++++++++

FROM webdevops/php-apache:8.5-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++ \
&& wget https://github.com/php/pie/releases/download/1.3.1/pie.phar -O /usr/local/bin/pie \
&& chmod +x /usr/local/bin/pie \
&& pie install xdebug/xdebug:^3.5.0@alpha \
&& rm -f /usr/local/bin/pie \
&& 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
11 changes: 11 additions & 0 deletions docker/php-apache-dev/8.5-alpine/Dockerfile.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ docker.from("php-apache", "8.5-alpine") }}

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

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

RUN set -x \
{{ php.officialDevelopmentAlpine(version="8.5") }} \
{{ 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,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

Check failure on line 5 in docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-xdebug.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a default case (*) to handle unexpected values.

See more on https://sonarcloud.io/project/issues?id=webdevops_Dockerfile&issues=AZrGLzidEWXyDk6PXHG5&open=AZrGLzidEWXyDk6PXHG5&pullRequest=553
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
Loading