From 5ba93445cf5fcb7fc069ce13ec72b3f5e7d50af6 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 10:36:33 +0000 Subject: [PATCH 01/17] [TASK] Move checks from unused tests into the tests the CI runs The CI picks structure-test suites per built tag, so the suites for old tags no longer ran, and some serverspec examples were never included. Their checks that still apply now run for every tag: - base-app: bzip2 for all tags; sponge (moreutils) for ubuntu-22.04 - base: netstat and sed for all tags - bootstrap: PATH for all tags - serverspec: docker-image-info dist-codename matches os-release on Debian and Ubuntu (the templates use it at build time) - serverspec: syslog-ng is installed in all PHP images The alpine suites of base and base-app are now covered by the common test.yaml. build.yaml is regenerated for the new suite paths. --- .github/workflows/build.yaml | 6 +++--- tests/serverspec/spec/collection/php.rb | 2 ++ .../serverspec/spec/shared/bootstrap/distribution.rb | 7 +++++++ tests/structure-test/base-app/alpine/test.yaml | 7 ------- tests/structure-test/base-app/test.yaml | 4 ++++ tests/structure-test/base-app/ubuntu-22.04/test.yaml | 6 ++++++ tests/structure-test/base/alpine/test.yaml | 11 ----------- tests/structure-test/base/test.yaml | 8 ++++++++ tests/structure-test/bootstrap/test.yaml | 2 ++ 9 files changed, 32 insertions(+), 21 deletions(-) delete mode 100644 tests/structure-test/base-app/alpine/test.yaml create mode 100644 tests/structure-test/base-app/ubuntu-22.04/test.yaml delete mode 100644 tests/structure-test/base/alpine/test.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 16ecc1b29..5eb67d06b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -214,7 +214,7 @@ jobs: name: 'run structure-test' run: |- cd tests/structure-test - /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base-app:sha-${{ github.sha }}-${{ matrix.arch }}-alpine --config base-app/test.yaml --config base-app/alpine/test.yaml + /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base-app:sha-${{ github.sha }}-${{ matrix.arch }}-alpine --config base-app/test.yaml - if: "${{github.ref == 'refs/heads/master'}}" name: 'Login to ghcr.io' @@ -332,7 +332,7 @@ jobs: name: 'run structure-test' run: |- cd tests/structure-test - /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base-app:sha-${{ github.sha }}-${{ matrix.arch }}-ubuntu-22.04 --config base-app/test.yaml + /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base-app:sha-${{ github.sha }}-${{ matrix.arch }}-ubuntu-22.04 --config base-app/test.yaml --config base-app/ubuntu-22.04/test.yaml - if: "${{github.ref == 'refs/heads/master'}}" name: 'Login to ghcr.io' @@ -475,7 +475,7 @@ jobs: name: 'run structure-test' run: |- cd tests/structure-test - /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base:sha-${{ github.sha }}-${{ matrix.arch }}-alpine --config base/test.yaml --config base/alpine/test.yaml + /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base:sha-${{ github.sha }}-${{ matrix.arch }}-alpine --config base/test.yaml - if: "${{github.ref == 'refs/heads/master'}}" name: 'Login to ghcr.io' diff --git a/tests/serverspec/spec/collection/php.rb b/tests/serverspec/spec/collection/php.rb index 92c0ac05e..68158f3f3 100644 --- a/tests/serverspec/spec/collection/php.rb +++ b/tests/serverspec/spec/collection/php.rb @@ -16,6 +16,8 @@ include_examples 'misc::graphicsmagick' include_examples 'misc::imagemagick' include_examples 'misc::ghostscript' + + include_examples 'base::syslog-ng' end shared_examples 'collection::php::production' do diff --git a/tests/serverspec/spec/shared/bootstrap/distribution.rb b/tests/serverspec/spec/shared/bootstrap/distribution.rb index ab627b0cd..252b238ab 100644 --- a/tests/serverspec/spec/shared/bootstrap/distribution.rb +++ b/tests/serverspec/spec/shared/bootstrap/distribution.rb @@ -97,6 +97,13 @@ its(:exit_status) { should eq 0 } end + describe command('docker-image-info dist-codename'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:stdout) { should eq command('. /etc/os-release && echo "$VERSION_CODENAME"').stdout } + its(:stdout) { should match /\A[a-z]+\n\z/ } + + its(:exit_status) { should eq 0 } + end + ######################### # Alpine ######################### diff --git a/tests/structure-test/base-app/alpine/test.yaml b/tests/structure-test/base-app/alpine/test.yaml deleted file mode 100644 index b51e97f50..000000000 --- a/tests/structure-test/base-app/alpine/test.yaml +++ /dev/null @@ -1,7 +0,0 @@ -schemaVersion: "2.0.0" - -commandTests: - - name: "bzip2" - command: "which" - args: ["bzip2"] - expectedOutput: ["/usr/bin/bzip2"] diff --git a/tests/structure-test/base-app/test.yaml b/tests/structure-test/base-app/test.yaml index 0df9e614b..ed8728d8a 100644 --- a/tests/structure-test/base-app/test.yaml +++ b/tests/structure-test/base-app/test.yaml @@ -60,3 +60,7 @@ commandTests: command: "which" args: ["patch"] expectedOutput: ["/usr/bin/patch"] + - name: "bzip2" + command: "which" + args: ["bzip2"] + expectedOutput: ["/usr/bin/bzip2"] diff --git a/tests/structure-test/base-app/ubuntu-22.04/test.yaml b/tests/structure-test/base-app/ubuntu-22.04/test.yaml new file mode 100644 index 000000000..dba3e7e6a --- /dev/null +++ b/tests/structure-test/base-app/ubuntu-22.04/test.yaml @@ -0,0 +1,6 @@ +schemaVersion: "2.0.0" +commandTests: + - name: "sponge (moreutils)" + command: "which" + args: ["sponge"] + expectedOutput: ["/usr/bin/sponge"] diff --git a/tests/structure-test/base/alpine/test.yaml b/tests/structure-test/base/alpine/test.yaml deleted file mode 100644 index 8d9be7b9a..000000000 --- a/tests/structure-test/base/alpine/test.yaml +++ /dev/null @@ -1,11 +0,0 @@ -schemaVersion: "2.0.0" - -commandTests: - - name: "netstat" - command: "which" - args: ["netstat"] - expectedOutput: ["/bin/netstat"] - - name: "sed" - command: "which" - args: ["sed"] - expectedOutput: ["/bin/sed"] \ No newline at end of file diff --git a/tests/structure-test/base/test.yaml b/tests/structure-test/base/test.yaml index ebb45f4b5..ce94f23f8 100644 --- a/tests/structure-test/base/test.yaml +++ b/tests/structure-test/base/test.yaml @@ -102,3 +102,11 @@ commandTests: command: "which" args: ["zic"] expectedOutput: ["/usr/sbin/zic"] + - name: "netstat" + command: "which" + args: ["netstat"] + expectedOutput: ["^/(usr/)?bin/netstat\\s*$"] + - name: "sed" + command: "which" + args: ["sed"] + expectedOutput: ["^/(usr/)?bin/sed\\s*$"] diff --git a/tests/structure-test/bootstrap/test.yaml b/tests/structure-test/bootstrap/test.yaml index c3e8447ac..33495e9e5 100644 --- a/tests/structure-test/bootstrap/test.yaml +++ b/tests/structure-test/bootstrap/test.yaml @@ -8,6 +8,8 @@ metadataTest: value: "C.UTF-8" - key: "TERM" value: "xterm" + - key: "PATH" + value: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" fileExistenceTests: - name: 'apk add wrapper' From d39505296f776f7b9ae1a68364c4b887b3b0a10d Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 10:36:33 +0000 Subject: [PATCH 02/17] [TASK] Remove tests that never run - serverspec: apache-dev_spec.rb (no such image), php-official_spec.rb (copy of php_spec.rb; the php job publishes php-official), and the unused examples base-app::packages, php::pear, python::toolchain, misc::graphviz, misc::letsencrypt, collection::bootstrap::upstream-image - testinfra: the only test was for webdevops/liquibase; also remove conftest.py and tests/__init__.py --- tests/__init__.py | 0 tests/serverspec/spec/collection/bootstrap.rb | 8 ----- .../serverspec/spec/docker/apache-dev_spec.rb | 14 --------- .../spec/docker/php-official_spec.rb | 17 ----------- .../spec/shared/base-app/packages.rb | 20 ------------- tests/serverspec/spec/shared/misc/tools.rb | 22 -------------- tests/serverspec/spec/shared/php/pear.rb | 7 ----- .../spec/shared/python/toolchain.rb | 18 ----------- tests/testinfra/__init__.py | 0 tests/testinfra/conf/app/php-test.php | 30 ------------------- tests/testinfra/conf/app/pi-number.html | 1 - tests/testinfra/test_liquibase.py | 14 --------- 12 files changed, 151 deletions(-) delete mode 100644 tests/__init__.py delete mode 100644 tests/serverspec/spec/docker/apache-dev_spec.rb delete mode 100644 tests/serverspec/spec/docker/php-official_spec.rb delete mode 100644 tests/serverspec/spec/shared/base-app/packages.rb delete mode 100644 tests/serverspec/spec/shared/php/pear.rb delete mode 100644 tests/serverspec/spec/shared/python/toolchain.rb delete mode 100644 tests/testinfra/__init__.py delete mode 100644 tests/testinfra/conf/app/php-test.php delete mode 100644 tests/testinfra/conf/app/pi-number.html delete mode 100644 tests/testinfra/test_liquibase.py diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/serverspec/spec/collection/bootstrap.rb b/tests/serverspec/spec/collection/bootstrap.rb index 0936aff20..06bfd1f6f 100644 --- a/tests/serverspec/spec/collection/bootstrap.rb +++ b/tests/serverspec/spec/collection/bootstrap.rb @@ -7,11 +7,3 @@ include_examples 'vendor::alpine::apk' end end - -shared_examples 'collection::bootstrap::upstream-image' do - include_examples 'bootstrap::distribution' - - if (os[:family] == 'alpine') - include_examples 'vendor::alpine::apk' - end -end diff --git a/tests/serverspec/spec/docker/apache-dev_spec.rb b/tests/serverspec/spec/docker/apache-dev_spec.rb deleted file mode 100644 index 4d839f035..000000000 --- a/tests/serverspec/spec/docker/apache-dev_spec.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'serverspec' -require 'docker' -require 'spec_init' - -describe "Dockerfile" do - before(:all) do - set :docker_image, ENV['DOCKERIMAGE_ID'] - end - - include_examples 'collection::bootstrap' - include_examples 'collection::base' - include_examples 'collection::apache' - -end diff --git a/tests/serverspec/spec/docker/php-official_spec.rb b/tests/serverspec/spec/docker/php-official_spec.rb deleted file mode 100644 index f5bafaeaf..000000000 --- a/tests/serverspec/spec/docker/php-official_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'serverspec' -require 'docker' -require 'spec_init' - -describe "Dockerfile" do - before(:all) do - set :docker_image, ENV['DOCKERIMAGE_ID'] - end - - include_examples 'collection::bootstrap' - include_examples 'collection::base' - include_examples 'collection::base-app' - include_examples 'collection::php::production' - include_examples 'collection::php-fpm' - include_examples 'collection::php-fpm::public' - -end diff --git a/tests/serverspec/spec/shared/base-app/packages.rb b/tests/serverspec/spec/shared/base-app/packages.rb deleted file mode 100644 index 28bad4dbc..000000000 --- a/tests/serverspec/spec/shared/base-app/packages.rb +++ /dev/null @@ -1,20 +0,0 @@ -shared_examples 'base-app::packages' do - [ - 'openssh-server', - 'dnsmasq', - 'postfix', - 'unzip', - 'bzip2', - 'wget', - 'curl', - 'moreutils', - 'rsync', - 'git', - 'nano', - 'net-tools', - ].each do |package| - describe package("#{package}") do - it { should be_installed } - end - end -end diff --git a/tests/serverspec/spec/shared/misc/tools.rb b/tests/serverspec/spec/shared/misc/tools.rb index bcf303c86..400c27c98 100644 --- a/tests/serverspec/spec/shared/misc/tools.rb +++ b/tests/serverspec/spec/shared/misc/tools.rb @@ -30,25 +30,3 @@ its(:exit_status) { should eq 0 } end end - -shared_examples 'misc::graphviz' do - it "should include graphviz" do - expect(file("/usr/bin/dot")).to be_executable - end - - describe command('/usr/bin/dot -V') do - its(:stderr) { should match %r!graphviz version! } - its(:exit_status) { should eq 0 } - end -end - -shared_examples 'misc::letsencrypt' do - it "should include certbot" do - expect(file("/usr/bin/certbot")).to be_executable - end - - describe command('/usr/bin/certbot --version') do - its(:stderr) { should match %r!certbot! } - its(:exit_status) { should eq 1 } - end -end diff --git a/tests/serverspec/spec/shared/php/pear.rb b/tests/serverspec/spec/shared/php/pear.rb deleted file mode 100644 index 0c731213f..000000000 --- a/tests/serverspec/spec/shared/php/pear.rb +++ /dev/null @@ -1,7 +0,0 @@ -shared_examples 'php::pear' do - describe command('pear') do - if (! (os[:family] == 'ubuntu' and os[:version] == '16.04') ) - its(:exit_status) { should eq 0 } - end - end -end diff --git a/tests/serverspec/spec/shared/python/toolchain.rb b/tests/serverspec/spec/shared/python/toolchain.rb deleted file mode 100644 index 8eeb1ea68..000000000 --- a/tests/serverspec/spec/shared/python/toolchain.rb +++ /dev/null @@ -1,18 +0,0 @@ -shared_examples 'python::toolchain' do - - describe command('python --version') do - its(:exit_status) { should eq 0 } - end - - describe command('easy_install --version'), :if => ['debian', 'ubuntu', 'redhat'].include?(os[:family]) do - its(:exit_status) { should eq 0 } - end - - describe command('easy_install-2.7 --version'), :if => ['alpine'].include?(os[:family]) do - its(:exit_status) { should eq 0 } - end - - describe command('pip --help') do - its(:exit_status) { should eq 0 } - end -end diff --git a/tests/testinfra/__init__.py b/tests/testinfra/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/testinfra/conf/app/php-test.php b/tests/testinfra/conf/app/php-test.php deleted file mode 100644 index ed3eb6b80..000000000 --- a/tests/testinfra/conf/app/php-test.php +++ /dev/null @@ -1,30 +0,0 @@ - Date: Sun, 8 Nov 2026 10:36:33 +0000 Subject: [PATCH 03/17] [TASK] Remove unused template macros docker.add, docker.volume, environment.mailbox, provision.registerRole and provision.runRoleInline are not called anywhere. Generated Dockerfiles are unchanged. --- template/Dockerfile/docker.jinja2 | 8 -------- template/Dockerfile/environment.jinja2 | 6 ------ template/Dockerfile/provision.jinja2 | 8 -------- 3 files changed, 22 deletions(-) diff --git a/template/Dockerfile/docker.jinja2 b/template/Dockerfile/docker.jinja2 index dc17193b9..e6c1bd0d0 100644 --- a/template/Dockerfile/docker.jinja2 +++ b/template/Dockerfile/docker.jinja2 @@ -13,10 +13,6 @@ LABEL maintainer=info@webdevops.io \ io.webdevops.version=1.5.0 {%- endmacro %} -{%- macro add(source, target) -%} -ADD {{ source }} {{ target }} -{%- endmacro -%} - {%- macro copy(source, target) -%} COPY {{ source }} {{ target }} {%- endmacro -%} @@ -29,10 +25,6 @@ EXPOSE {{ port }} WORKDIR {{ path }} {%- endmacro -%} -{%- macro volume(volume) -%} -VOLUME {{ volume }} -{%- endmacro -%} - {%- macro entrypoint(command) -%} ENTRYPOINT ["{{ command }}"] {%- endmacro -%} diff --git a/template/Dockerfile/environment.jinja2 b/template/Dockerfile/environment.jinja2 index c71e037d6..4a78fa603 100644 --- a/template/Dockerfile/environment.jinja2 +++ b/template/Dockerfile/environment.jinja2 @@ -5,12 +5,6 @@ ENV TERM="xterm" \ {%- endmacro %} -{% macro mailbox() -%} -ENV MAILBOX_USERNAME="dev" \ - MAILBOX_PASSWORD="dev" -{%- endmacro %} - - {% macro web() -%} ENV WEB_DOCUMENT_ROOT=/app \ WEB_DOCUMENT_INDEX=index.php \ diff --git a/template/Dockerfile/provision.jinja2 b/template/Dockerfile/provision.jinja2 index 36bce08cf..4018504b4 100644 --- a/template/Dockerfile/provision.jinja2 +++ b/template/Dockerfile/provision.jinja2 @@ -1,10 +1,2 @@ -{% macro runRoleInline() %} - {%- if varargs -%}&& /opt/docker/bin/provision run --tag bootstrap {% for roleArg in varargs -%}{% set roleList = roleArg.split(' ') %}{% for role in roleList -%} - {% if role %}--role webdevops-{{ role }} {% endif %} - {%- endfor -%}{%- endfor -%} - \{%- endif %} - && /opt/docker/bin/bootstrap.sh{% endmacro %} - {% macro runBootstrap() %}&& docker-run-bootstrap{% endmacro %} -{% macro registerRole(role='',bootstrap=False,build=False,onbuild=False,entrypoint=False) %}&& /opt/docker/bin/provision add {%if bootstrap%}--tag bootstrap {% endif %}{%if build%}--tag build {% endif %}{%if onbuild%}--tag onbuild {% endif %}{%if entrypoint%}--tag entrypoint {% endif %} webdevops-{{ role }}{% endmacro %} From b7e7e52eba80fc795ab40647721aaebf2057326d Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 10:36:33 +0000 Subject: [PATCH 04/17] [TASK] Remove Makefile targets that do not work Keep provision, graph and graph-full (Python 2, inside dockerfile-build-env), structure-test and setup, which the dockerfile-build-env image runs while it is built. Remove list, full, all, build, push, test and the image groups, which point to images that no longer exist. Drop webdevops/ansible from conf/diagram.yml. README, AGENTS.md and the build-tools known issue describe the remaining targets. --- AGENTS.md | 2 +- Makefile | 39 +---------------------------------- README.md | 4 ++-- conf/diagram.yml | 1 - conftest.py | 49 -------------------------------------------- docs/known-issues.md | 2 +- 6 files changed, 5 insertions(+), 92 deletions(-) delete mode 100644 conftest.py diff --git a/AGENTS.md b/AGENTS.md index 4b759b0a5..da2737e39 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,7 +23,7 @@ Only these commands are known to work: - `docker build -t webdevops/: docker//` builds one image; its parent and `webdevops/toolbox` come from local images or Docker Hub. - `./build-local.sh [version]` builds all PHP images of one version. -The other Makefile targets need Python 2. Apart from `provision` and `graph` inside `webdevops/dockerfile-build-env`, they do not work; `make test` fails there too (see `docs/known-issues.md`). The CI runs serverspec and container-structure-test for every image; to check a change by hand, start the image and try it as described below. +Besides `provision`, the Makefile has `graph` (also Python 2, inside `webdevops/dockerfile-build-env`), `structure-test` (runs container-structure-test against your local images, for example inside `webdevops/dockerfile-build-env` with the Docker socket mounted) and `setup`, which the `webdevops/dockerfile-build-env` image runs while it is built. The CI runs serverspec and container-structure-test for every image; to check a change by hand, start the image and try it as described below. ## Keep the documentation up to date diff --git a/Makefile b/Makefile index d3deb9cf6..a905b3952 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,5 @@ -ARGS = $(filter-out $@,$(MAKECMDGOALS)) MAKEFLAGS += --silent -.PHONY: test provision - -DOCKER_REPOSITORY=`cat DOCKER_REPOSITORY` -DOCKER_TAG_LATEST=`cat DOCKER_TAG_LATEST` - -list: - sh -c "echo; $(MAKE) -p no_targets__ |\ - awk -F':' '/^[a-zA-Z0-9][^\$$#\\t=]*:([^=]|$$)/ {split(\$$1,A,/ /);\ - for(i in A)print A[i]}' | \ - grep -v '__\$$\|Makefile\|%' | \ - sort" - -full: provision build - -all: build - -build: - python2 ./bin/console docker:build --threads=auto - -bootstrap: webdevops/bootstrap webdevops/ansible -base: webdevops/base webdevops/base-app - -php: webdevops/php webdevops/php-apache webdevops/php-nginx -php-dev: webdevops/php-dev webdevops/php-apache-dev webdevops/php-nginx-dev -hhvm: webdevops/hhvm webdevops/hhvm-apache webdevops/hhvm-nginx - -web: webdevops/apache webdevops/apache-dev webdevops/nginx webdevops/nginx-dev webdevops/varnish webdevops/certbot - -applications: webdevops/typo3 webdevops/piwik - -misc: webdevops/mail-sandbox webdevops/sphinx webdevops/liquibase +.PHONY: setup requirements structure-test provision graph graph-full setup: requirements @@ -38,9 +7,6 @@ requirements: pip install --upgrade -I -r ./bin/requirements.txt cd tests/serverspec && bundle install --path=vendor -test: - python2 bin/console test:serverspec --threads=auto -v - structure-test: cd tests/structure-test && ./run.sh @@ -48,9 +14,6 @@ provision: python2 bin/console generate:dockerfile python2 bin/console generate:provision -push: - python2 ./bin/console docker:push --threads=auto - graph: python2 ./bin/console generate:graph diff --git a/README.md b/README.md index 9962c98d9..7716c5667 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,8 @@ Build all PHP images of one version (default `8.5`), in the order they depend on ./build-local.sh 8.4 ``` -Then try an image with the quick start above. `make test` and the other Makefile targets that call `bin/console` need Python 2; -only `make provision` and `make graph` still work, inside `webdevops/dockerfile-build-env`. See [Known issues](docs/known-issues.md#build-tools). +Then try an image with the quick start above. `make provision` and `make graph` call `bin/console`, which needs Python 2; +run them inside `webdevops/dockerfile-build-env`. See [Known issues](docs/known-issues.md#build-tools). ### PHP extension builds diff --git a/conf/diagram.yml b/conf/diagram.yml index 1011ec3f2..cf5644cf5 100644 --- a/conf/diagram.yml +++ b/conf/diagram.yml @@ -70,7 +70,6 @@ diagram: docker: - webdevops/bootstrap - webdevops/base.* - - webdevops/ansible php: name: PHP images rank: 3 diff --git a/conftest.py b/conftest.py deleted file mode 100644 index b26fcf303..000000000 --- a/conftest.py +++ /dev/null @@ -1,49 +0,0 @@ -import os, time -import pytest, testinfra - -conftest_path = os.path.dirname(os.path.realpath(__file__)) -test_path = os.path.join(conftest_path, 'tests') -test_conf_path = os.path.join(test_path, 'conf') -test_conf_app_path = os.path.join(test_conf_path, 'app') - -# Use testinfra to get a handy function to run commands locally -check_output = testinfra.get_backend( - "local://" -).get_module("Command").check_output - - -@pytest.fixture -def TestinfraBackend(request): - # Override the TestinfraBackend fixture, - # all testinfra fixtures (i.e. modules) depend on it. - - docker_command = '' - docker_image = request.param - docker_sleeptime = 5 - - # Check for custom command in docker image name - if "#" in docker_image: - docker_image, docker_command = docker_image.split("#", 2) - - if docker_command == "loop": - docker_command = 'tail -f /dev/null' - docker_sleeptime = 0 - - docker_id = check_output( - "docker run -d -v \"%s:/app:ro\" %s " + docker_command, - test_conf_app_path, - docker_image - ) - - def teardown(): - check_output("docker rm -f %s", docker_id) - - # Destroy the container at the end of the fixture life - request.addfinalizer(teardown) - - # wait for getting the image up - if docker_sleeptime: - time.sleep(docker_sleeptime) - - # Return a dynamic created backend - return testinfra.get_backend("docker://" + docker_id) diff --git a/docs/known-issues.md b/docs/known-issues.md index 0ea055085..f2a942f7a 100644 --- a/docs/known-issues.md +++ b/docs/known-issues.md @@ -146,7 +146,7 @@ These options and tools are part of the images but do not work, or work only in ## Build tools -- **Effect:** The Makefile targets that call `bin/console` (`provision`, `build`, `push`, `test`, `graph`) need Python 2. On a host without Python 2 they fail with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env`, `make provision` and `make graph` work, but `make test` fails as well. +- **Effect:** The Makefile targets `provision` and `graph` call `bin/console`, which needs Python 2. On a host without Python 2 they fail with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env` both work. - **Instead:** Run `make provision` in `webdevops/dockerfile-build-env` as shown in the [README](../README.md#file-generation). Build images with `docker build` or `./build-local.sh`, see [Building and testing locally](../README.md#building-and-testing-locally). The CI runs the serverspec and structure tests for every image. - **Issue:** [#549](https://github.com/webdevops/Dockerfile/issues/549) (move away from Python 2). From 7543332710e8203685f783b34f2a15d124795547 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 11:39:47 +0000 Subject: [PATCH 05/17] [TASK] Fix review findings in the moved tests - Move the sponge check from the ubuntu-22.04 structure-test suite to serverspec, conditional on Ubuntu, so it does not depend on the tag name. build.yaml is regenerated. - Remove the PATH check from the bootstrap alpine suite; the common test.yaml has it. - tests/structure-test/run.sh: test every directory with a test.yaml (php-dev and php-nginx were missing) and exit non-zero if any image fails, not only the last one. --- .github/workflows/build.yaml | 2 +- .../bootstrap.d/20-php-module-blackfire.sh | 6 ------ .../php/general/etc/logrotate.d/php5-fpm | 12 ----------- tests/serverspec/spec/collection/base-app.rb | 1 + .../spec/shared/base-app/moreutils.rb | 6 ++++++ .../base-app/ubuntu-22.04/test.yaml | 6 ------ .../structure-test/bootstrap/alpine/test.yaml | 5 ----- tests/structure-test/run.sh | 21 ++++++++++++------- 8 files changed, 21 insertions(+), 38 deletions(-) delete mode 100644 provisioning/php-dev/general/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 provisioning/php/general/etc/logrotate.d/php5-fpm create mode 100644 tests/serverspec/spec/shared/base-app/moreutils.rb delete mode 100644 tests/structure-test/base-app/ubuntu-22.04/test.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5eb67d06b..c8d43f4ed 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -332,7 +332,7 @@ jobs: name: 'run structure-test' run: |- cd tests/structure-test - /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base-app:sha-${{ github.sha }}-${{ matrix.arch }}-ubuntu-22.04 --config base-app/test.yaml --config base-app/ubuntu-22.04/test.yaml + /usr/local/bin/container-structure-test test --image ghcr.io/webdevops/base-app:sha-${{ github.sha }}-${{ matrix.arch }}-ubuntu-22.04 --config base-app/test.yaml - if: "${{github.ref == 'refs/heads/master'}}" name: 'Login to ghcr.io' diff --git a/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-blackfire.sh b/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/provisioning/php/general/etc/logrotate.d/php5-fpm b/provisioning/php/general/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/provisioning/php/general/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/tests/serverspec/spec/collection/base-app.rb b/tests/serverspec/spec/collection/base-app.rb index d5f180cfd..d78d04980 100644 --- a/tests/serverspec/spec/collection/base-app.rb +++ b/tests/serverspec/spec/collection/base-app.rb @@ -1,4 +1,5 @@ shared_examples 'collection::base-app' do include_examples 'base-app::locales' include_examples 'base-app::application-user' + include_examples 'base-app::moreutils' end diff --git a/tests/serverspec/spec/shared/base-app/moreutils.rb b/tests/serverspec/spec/shared/base-app/moreutils.rb new file mode 100644 index 000000000..92bab99f7 --- /dev/null +++ b/tests/serverspec/spec/shared/base-app/moreutils.rb @@ -0,0 +1,6 @@ +shared_examples 'base-app::moreutils' do + describe command('command -v sponge'), :if => os[:family] == 'ubuntu' do + its(:stdout) { should eq "/usr/bin/sponge\n" } + its(:exit_status) { should eq 0 } + end +end diff --git a/tests/structure-test/base-app/ubuntu-22.04/test.yaml b/tests/structure-test/base-app/ubuntu-22.04/test.yaml deleted file mode 100644 index dba3e7e6a..000000000 --- a/tests/structure-test/base-app/ubuntu-22.04/test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -schemaVersion: "2.0.0" -commandTests: - - name: "sponge (moreutils)" - command: "which" - args: ["sponge"] - expectedOutput: ["/usr/bin/sponge"] diff --git a/tests/structure-test/bootstrap/alpine/test.yaml b/tests/structure-test/bootstrap/alpine/test.yaml index 6df7622be..8d3a593a3 100644 --- a/tests/structure-test/bootstrap/alpine/test.yaml +++ b/tests/structure-test/bootstrap/alpine/test.yaml @@ -1,10 +1,5 @@ schemaVersion: "2.0.0" -metadataTest: - envVars: - - key: "PATH" - value: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - commandTests: - name: "Check OS family" command: "docker-image-info" diff --git a/tests/structure-test/run.sh b/tests/structure-test/run.sh index 1801a5106..b95df05d5 100755 --- a/tests/structure-test/run.sh +++ b/tests/structure-test/run.sh @@ -1,10 +1,13 @@ #!/bin/bash +# Runs container-structure-test against every local webdevops image that has a suite in this directory. +# Exits non-zero if any image fails. -TEST_REPOS="bootstrap base base-app php" +cd "$(dirname "$0")" || exit 1 -for testRepo in ${TEST_REPOS}; do - if [[ ! -f $testRepo/test.yaml ]]; then - echo "Skipping tests for webdevops/$testRepo as no common test.yaml was found" +FAILED=0 +for testRepo in */; do + testRepo="${testRepo%/}" + if [[ ! -f "$testRepo/test.yaml" ]]; then continue fi TEST_IMAGES="$(docker images -f "reference=webdevops/${testRepo}" --format "{{.Tag}}")" @@ -15,10 +18,12 @@ for testRepo in ${TEST_REPOS}; do echo "==============================================" echo "Testing: webdevops/$testRepo:$imageTag" echo "==============================================" - if [[ -f $testRepo/$imageTag/test.yaml ]]; then - container-structure-test test --image webdevops/$testRepo:$imageTag --config $testRepo/$imageTag/test.yaml --config $testRepo/test.yaml - else - container-structure-test test --image webdevops/$testRepo:$imageTag --config $testRepo/test.yaml + CONFIGS=(--config "$testRepo/test.yaml") + if [[ -f "$testRepo/$imageTag/test.yaml" ]]; then + CONFIGS+=(--config "$testRepo/$imageTag/test.yaml") fi + container-structure-test test --image "webdevops/$testRepo:$imageTag" "${CONFIGS[@]}" || FAILED=1 done done + +exit $FAILED From f85924a44efa15f6689fcb04089b8fd2dfeb4b84 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 11:39:48 +0000 Subject: [PATCH 06/17] [TASK] Remove more PHP 5 leftovers from provisioning - 20-php-module-blackfire.sh only deleted files under /etc/php5. - logrotate.d/php5-fpm rotated /var/log/php5-fpm/*, which does not exist. - 10-php.sh (dev) and 20-setup-php-fpm.sh: drop the branches for PHP older than 5.6; the [::]:9000 listen line now runs unconditionally, as it already did for every built image. --- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.2/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.3/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.4/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.5/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.2/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.3/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.4/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.5/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.2/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.3/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.4/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.5/conf/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../bootstrap.d/20-php-module-blackfire.sh | 6 ---- .../8.2-alpine/conf/etc/logrotate.d/php5-fpm | 12 -------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- .../8.2/conf/etc/logrotate.d/php5-fpm | 12 -------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- .../8.3-alpine/conf/etc/logrotate.d/php5-fpm | 12 -------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- .../8.3/conf/etc/logrotate.d/php5-fpm | 12 -------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- .../8.4-alpine/conf/etc/logrotate.d/php5-fpm | 12 -------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- .../8.4/conf/etc/logrotate.d/php5-fpm | 12 -------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- .../8.5-alpine/conf/etc/logrotate.d/php5-fpm | 12 -------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- .../8.5/conf/etc/logrotate.d/php5-fpm | 12 -------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- .../general/provision/bootstrap.d/10-php.sh | 22 ++++----------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 28 ++++--------------- 66 files changed, 170 insertions(+), 872 deletions(-) delete mode 100644 docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh delete mode 100644 docker/php-official/8.2-alpine/conf/etc/logrotate.d/php5-fpm delete mode 100644 docker/php-official/8.2/conf/etc/logrotate.d/php5-fpm delete mode 100644 docker/php-official/8.3-alpine/conf/etc/logrotate.d/php5-fpm delete mode 100644 docker/php-official/8.3/conf/etc/logrotate.d/php5-fpm delete mode 100644 docker/php-official/8.4-alpine/conf/etc/logrotate.d/php5-fpm delete mode 100644 docker/php-official/8.4/conf/etc/logrotate.d/php5-fpm delete mode 100644 docker/php-official/8.5-alpine/conf/etc/logrotate.d/php5-fpm delete mode 100644 docker/php-official/8.5/conf/etc/logrotate.d/php5-fpm diff --git a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh deleted file mode 100644 index f4ea7f72e..000000000 --- a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-blackfire.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/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 diff --git a/docker/php-official/8.2-alpine/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.2-alpine/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.2-alpine/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.2/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.2/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.2/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.3-alpine/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.3-alpine/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.3-alpine/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.3/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.3/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.3/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.4-alpine/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.4-alpine/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.4-alpine/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.4/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.4/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.4/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.5-alpine/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.5-alpine/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.5-alpine/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/docker/php-official/8.5/conf/etc/logrotate.d/php5-fpm b/docker/php-official/8.5/conf/etc/logrotate.d/php5-fpm deleted file mode 100644 index e6ef4b123..000000000 --- a/docker/php-official/8.5/conf/etc/logrotate.d/php5-fpm +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/php5-fpm/fpm.log -/var/log/php5-fpm/access.log -/var/log/php5-fpm/slow.log -/var/log/php5-fpm/error.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -SIGUSR1 `cat /var/run/php5-fpm.pid` 2>/dev/null || true - endscript -} diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh b/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh index 59b4f08b8..1d1d33fb2 100644 --- a/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh +++ b/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh @@ -1,24 +1,12 @@ #!/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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' diff --git a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh index 873ddf608..7d3079ec0 100644 --- a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,26 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.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' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' -else - # listen on public IPv6 port - go-replace --mode=line --regex \ - -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ - --path=/opt/docker/etc/php/fpm/ \ - --path-pattern='*.conf' - -fi - -if [[ "$(version-compare "$PHP_VERSION" "5.99.999")" == "<" ]]; then - # Configure php-fpm main (php 5.x) - go-replace --mode=lineinfile --regex \ - --lineinfile-after='\[global\]' \ - -s '^[\s;]*daemonize[\s]*=' -r 'daemonize = no' \ - -- /opt/docker/etc/php/fpm/php-fpm.conf -fi +# Listen on all IPv6 and IPv4 addresses +go-replace --mode=line --regex \ + -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ + --path=/opt/docker/etc/php/fpm/ \ + --path-pattern='*.conf' From f07ec1b834509c5ab794a2a0a1b2709de90beb4d Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 11:39:48 +0000 Subject: [PATCH 07/17] [TASK] Restore make list and describe the Makefile precisely - Keep list as the first target, so a bare make lists the targets instead of running setup. - README, AGENTS.md and the build-tools known issue name graph-full, AGENTS.md says which images make structure-test and the CI test. --- AGENTS.md | 4 ++-- Makefile | 9 ++++++++- README.md | 2 +- docs/known-issues.md | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index da2737e39..667fb24c0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ | `docker///Dockerfile.jinja2` | Per-image template (source) | | `provisioning/` | Scripts and configuration files copied into the images (source); `conf/provision.yml` says which go where | | `docker///Dockerfile`, `docker///conf/` | Generated by `make provision`, never edited by hand | -| `bin/` | Old Python 2 tools behind `make provision` and the other Makefile targets | +| `bin/` | Old Python 2 tools behind `make provision`, `make graph` and `make graph-full` | | `ci/` | PHP generator for `.github/workflows/build.yaml` (`ci/console github:generate-ci`) | | `tests/` | serverspec (Ruby) and container-structure-test definitions run by the CI | | `docs/` | User documentation | @@ -23,7 +23,7 @@ Only these commands are known to work: - `docker build -t webdevops/: docker//` builds one image; its parent and `webdevops/toolbox` come from local images or Docker Hub. - `./build-local.sh [version]` builds all PHP images of one version. -Besides `provision`, the Makefile has `graph` (also Python 2, inside `webdevops/dockerfile-build-env`), `structure-test` (runs container-structure-test against your local images, for example inside `webdevops/dockerfile-build-env` with the Docker socket mounted) and `setup`, which the `webdevops/dockerfile-build-env` image runs while it is built. The CI runs serverspec and container-structure-test for every image; to check a change by hand, start the image and try it as described below. +Besides `provision`, the Makefile has `graph` and `graph-full` (also Python 2, inside `webdevops/dockerfile-build-env`), `structure-test` and `setup`, which the `webdevops/dockerfile-build-env` image runs while it is built. `make structure-test` runs container-structure-test against your local images of `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`, the images that have a suite in `tests/structure-test`; run it inside `webdevops/dockerfile-build-env` with the Docker socket mounted. The CI runs serverspec for every image except `toolbox` and `dockerfile-build-env`, and container-structure-test for the six images above; to check a change by hand, start the image and try it as described below. ## Keep the documentation up to date diff --git a/Makefile b/Makefile index a905b3952..362354552 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,12 @@ MAKEFLAGS += --silent -.PHONY: setup requirements structure-test provision graph graph-full +.PHONY: list setup requirements structure-test provision graph graph-full + +list: + sh -c "echo; $(MAKE) -p no_targets__ |\ + awk -F':' '/^[a-zA-Z0-9][^\$$#\\t=]*:([^=]|$$)/ {split(\$$1,A,/ /);\ + for(i in A)print A[i]}' | \ + grep -v '__\$$\|Makefile\|%' | \ + sort" setup: requirements diff --git a/README.md b/README.md index 7716c5667..5085433ca 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Build all PHP images of one version (default `8.5`), in the order they depend on ./build-local.sh 8.4 ``` -Then try an image with the quick start above. `make provision` and `make graph` call `bin/console`, which needs Python 2; +Then try an image with the quick start above. `make provision`, `make graph` and `make graph-full` call `bin/console`, which needs Python 2; run them inside `webdevops/dockerfile-build-env`. See [Known issues](docs/known-issues.md#build-tools). ### PHP extension builds diff --git a/docs/known-issues.md b/docs/known-issues.md index f2a942f7a..cd965e89f 100644 --- a/docs/known-issues.md +++ b/docs/known-issues.md @@ -146,7 +146,7 @@ These options and tools are part of the images but do not work, or work only in ## Build tools -- **Effect:** The Makefile targets `provision` and `graph` call `bin/console`, which needs Python 2. On a host without Python 2 they fail with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env` both work. +- **Effect:** The Makefile targets `provision`, `graph` and `graph-full` call `bin/console`, which needs Python 2. On a host without Python 2 they fail with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env` they work. - **Instead:** Run `make provision` in `webdevops/dockerfile-build-env` as shown in the [README](../README.md#file-generation). Build images with `docker build` or `./build-local.sh`, see [Building and testing locally](../README.md#building-and-testing-locally). The CI runs the serverspec and structure tests for every image. - **Issue:** [#549](https://github.com/webdevops/Dockerfile/issues/549) (move away from Python 2). From ec6bac1986d635d6580853d2b2d520361fefb9b0 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 13:58:40 +0000 Subject: [PATCH 08/17] [TASK] Remove dead PHP-FPM and opcache settings - 20-setup-php-fpm.sh removed the literal file "PHP_MAIN_CONF" instead of $PHP_MAIN_CONF. - clear_env exists in all supported PHP versions, so the workaround for PHP-FPM without it (PHP_CLEAR_ENV_AVAILABLE, 11-clear-env.sh) is gone. - PHP_VERSION in 10-php-init.sh was not used; 30-setup-ioncube.sh sets its own. - opcache.fast_shutdown no longer exists since PHP 7.2; it is removed from php.webdevops.ini and from the development settings. - The structure tests name what 10-php-init.sh and 11-php-conf.sh do. - .editorconfig no longer has sections for DOCKER_REPOSITORY and DOCKER_TAG_LATEST, which do not exist. - `make` no longer prints "No rule to make target 'no_targets__'". --- .editorconfig | 6 --- Makefile | 2 +- .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../8.2-alpine/conf/etc/php/php.webdevops.ini | 1 - .../conf/provision/bootstrap.d/10-php-init.sh | 1 - .../conf/provision/bootstrap.d/11-php-conf.sh | 2 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../8.2/conf/etc/php/php.webdevops.ini | 1 - .../conf/provision/bootstrap.d/10-php-init.sh | 1 - .../conf/provision/bootstrap.d/11-php-conf.sh | 2 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../8.3-alpine/conf/etc/php/php.webdevops.ini | 1 - .../conf/provision/bootstrap.d/10-php-init.sh | 1 - .../conf/provision/bootstrap.d/11-php-conf.sh | 2 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../8.3/conf/etc/php/php.webdevops.ini | 1 - .../conf/provision/bootstrap.d/10-php-init.sh | 1 - .../conf/provision/bootstrap.d/11-php-conf.sh | 2 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../8.4-alpine/conf/etc/php/php.webdevops.ini | 1 - .../conf/provision/bootstrap.d/10-php-init.sh | 1 - .../conf/provision/bootstrap.d/11-php-conf.sh | 2 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../8.4/conf/etc/php/php.webdevops.ini | 1 - .../conf/provision/bootstrap.d/10-php-init.sh | 1 - .../conf/provision/bootstrap.d/11-php-conf.sh | 2 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../8.5-alpine/conf/etc/php/php.webdevops.ini | 1 - .../conf/provision/bootstrap.d/10-php-init.sh | 1 - .../conf/provision/bootstrap.d/11-php-conf.sh | 2 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../8.5/conf/etc/php/php.webdevops.ini | 1 - .../conf/provision/bootstrap.d/10-php-init.sh | 1 - .../conf/provision/bootstrap.d/11-php-conf.sh | 2 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../bootstrap.d/20-php-module-opcache.sh | 1 - .../bin/service.d/php-fpm.d/11-clear-env.sh | 38 ------------------- .../php/general/etc/php/php.webdevops.ini | 1 - .../provision/bootstrap.d/10-php-init.sh | 1 - .../bootstrap.d/20-setup-php-fpm-pool.sh | 15 ++------ .../provision/bootstrap.d/20-setup-php-fpm.sh | 2 +- .../provision/bootstrap.d/11-php-conf.sh | 2 - tests/structure-test/php/test.yaml | 4 +- 82 files changed, 48 insertions(+), 520 deletions(-) delete mode 100644 docker/php-official/8.2-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh delete mode 100644 docker/php-official/8.2/conf/bin/service.d/php-fpm.d/11-clear-env.sh delete mode 100644 docker/php-official/8.3-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh delete mode 100644 docker/php-official/8.3/conf/bin/service.d/php-fpm.d/11-clear-env.sh delete mode 100644 docker/php-official/8.4-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh delete mode 100644 docker/php-official/8.4/conf/bin/service.d/php-fpm.d/11-clear-env.sh delete mode 100644 docker/php-official/8.5-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh delete mode 100644 docker/php-official/8.5/conf/bin/service.d/php-fpm.d/11-clear-env.sh delete mode 100644 provisioning/php/general/bin/service.d/php-fpm.d/11-clear-env.sh diff --git a/.editorconfig b/.editorconfig index 4ca38ef6a..e5bcd85b6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -26,11 +26,5 @@ indent_size = 2 [*.php] indent_size = 4 -[DOCKER_REPOSITORY] -insert_final_newline = false - -[DOCKER_TAG_LATEST] -insert_final_newline = false - [BLACKLIST] insert_final_newline = false diff --git a/Makefile b/Makefile index 362354552..7773a52a4 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ MAKEFLAGS += --silent .PHONY: list setup requirements structure-test provision graph graph-full list: - sh -c "echo; $(MAKE) -p no_targets__ |\ + sh -c "echo; $(MAKE) -p no_targets__ 2>/dev/null |\ awk -F':' '/^[a-zA-Z0-9][^\$$#\\t=]*:([^=]|$$)/ {split(\$$1,A,/ /);\ for(i in A)print A[i]}' | \ grep -v '__\$$\|Makefile\|%' | \ diff --git a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh +++ b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/docker/php-official/8.2-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.2-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.2-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.2-alpine/conf/etc/php/php.webdevops.ini b/docker/php-official/8.2-alpine/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.2-alpine/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.2-alpine/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/docker/php-official/8.2/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.2/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.2/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.2/conf/etc/php/php.webdevops.ini b/docker/php-official/8.2/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.2/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.2/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/docker/php-official/8.3-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.3-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.3-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.3-alpine/conf/etc/php/php.webdevops.ini b/docker/php-official/8.3-alpine/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.3-alpine/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.3-alpine/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/docker/php-official/8.3/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.3/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.3/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.3/conf/etc/php/php.webdevops.ini b/docker/php-official/8.3/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.3/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.3/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/docker/php-official/8.4-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.4-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.4-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.4-alpine/conf/etc/php/php.webdevops.ini b/docker/php-official/8.4-alpine/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.4-alpine/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.4-alpine/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/docker/php-official/8.4/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.4/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.4/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.4/conf/etc/php/php.webdevops.ini b/docker/php-official/8.4/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.4/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.4/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/docker/php-official/8.5-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.5-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.5-alpine/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.5-alpine/conf/etc/php/php.webdevops.ini b/docker/php-official/8.5-alpine/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.5-alpine/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.5-alpine/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/docker/php-official/8.5/conf/bin/service.d/php-fpm.d/11-clear-env.sh b/docker/php-official/8.5/conf/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/docker/php-official/8.5/conf/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/docker/php-official/8.5/conf/etc/php/php.webdevops.ini b/docker/php-official/8.5/conf/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/docker/php-official/8.5/conf/etc/php/php.webdevops.ini +++ b/docker/php-official/8.5/conf/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/10-php-init.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/10-php-init.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/11-php-conf.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/11-php-conf.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-opcache.sh b/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-opcache.sh index 079e59fdf..0bbb940b4 100644 --- a/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-opcache.sh +++ b/provisioning/php-dev/general/provision/bootstrap.d/20-php-module-opcache.sh @@ -7,5 +7,4 @@ go-replace --mode=lineinfile --regex \ -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 diff --git a/provisioning/php/general/bin/service.d/php-fpm.d/11-clear-env.sh b/provisioning/php/general/bin/service.d/php-fpm.d/11-clear-env.sh deleted file mode 100644 index ef6fd4016..000000000 --- a/provisioning/php/general/bin/service.d/php-fpm.d/11-clear-env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# -# Workaround for old php-fpm versions which don't have clear_env setting -# - -VARIABLE_LIST="; Workaround for missing clear_env feature in PHP-FPM" - -# For each exported variable -for envVariable in $(printenv|cut -f1 -d=); do - - case "$envVariable" in - "_"|"PATH"|"PWD") - ## ignore this variables - ;; - - *) - ## get content of variable - envVariableContent="${!envVariable}" - - ## php-fpm requires that env variable has to be filled with content - if [[ -n "$envVariableContent" ]]; then - ## quote quotes - envVariableContent=${envVariableContent//\"/\\\"} - - ## add to list - VARIABLE_LIST="${VARIABLE_LIST}"$'\n'"env[${envVariable}] = \"${envVariableContent}\"" - fi - ;; - esac - -done - -# Replace ;#CLEAR_ENV_WORKAROUND# with environment variable list for all php-fpm pool files -go-replace \ - -s ";#CLEAR_ENV_WORKAROUND#" -r "$VARIABLE_LIST" \ - --path=/opt/docker/etc/php/fpm/pool.d/ \ - --path-pattern='*.conf' \ - --ignore-empty - diff --git a/provisioning/php/general/etc/php/php.webdevops.ini b/provisioning/php/general/etc/php/php.webdevops.ini index 3225cb602..829c21e23 100644 --- a/provisioning/php/general/etc/php/php.webdevops.ini +++ b/provisioning/php/general/etc/php/php.webdevops.ini @@ -34,4 +34,3 @@ mysqli.default_host = mysql opcache.memory_consumption = 256 opcache.interned_strings_buffer = 16 opcache.max_accelerated_files = 7963 -opcache.fast_shutdown = 1 diff --git a/provisioning/php/general/provision/bootstrap.d/10-php-init.sh b/provisioning/php/general/provision/bootstrap.d/10-php-init.sh index db0141b8f..72d9f2454 100644 --- a/provisioning/php/general/provision/bootstrap.d/10-php-init.sh +++ b/provisioning/php/general/provision/bootstrap.d/10-php-init.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash -PHP_VERSION=$(php -r 'echo phpversion();' | cut -d '-' -f 1) IMAGE_FAMILY=$(docker-image-info family) diff --git a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm-pool.sh b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm-pool.sh index 121788e60..c5d50e3ea 100644 --- a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm-pool.sh +++ b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm-pool.sh @@ -32,14 +32,7 @@ go-replace --mode=line --regex \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' -if [[ "$PHP_CLEAR_ENV_AVAILABLE" -eq 1 ]]; then - # Clear env setting available, disable clearing of environment variables - go-replace --mode=lineinfile --regex \ - -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ - -- /opt/docker/etc/php/fpm/pool.d/application.conf - rm -f /opt/docker/bin/service.d/php-fpm.d/11-clear-env.sh -else - # Append clear env workaround in php-fpm pool (old php-fpm versions) - echo ';#CLEAR_ENV_WORKAROUND#' >> /opt/docker/etc/php/fpm/pool.d/application.conf - -fi +# Keep the environment variables of the container for PHP +go-replace --mode=lineinfile --regex \ + -s '^[\s;]*clear_env[\s]*=' -r 'clear_env = no' \ + -- /opt/docker/etc/php/fpm/pool.d/application.conf diff --git a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh index 7d3079ec0..d37088954 100644 --- a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh @@ -7,7 +7,7 @@ ln -sf -- "$PHP_FPM_BIN" /usr/local/bin/php-fpm if [[ ! -f /opt/docker/etc/php/fpm/php-fpm.conf ]]; then mv -- "$PHP_MAIN_CONF" /opt/docker/etc/php/fpm/php-fpm.conf else - rm -f -- "PHP_MAIN_CONF" + rm -f -- "$PHP_MAIN_CONF" fi ln -sf -- /opt/docker/etc/php/fpm/php-fpm.conf "$PHP_MAIN_CONF" diff --git a/provisioning/php/official/provision/bootstrap.d/11-php-conf.sh b/provisioning/php/official/provision/bootstrap.d/11-php-conf.sh index ee56ccaae..7b8f6d3db 100644 --- a/provisioning/php/official/provision/bootstrap.d/11-php-conf.sh +++ b/provisioning/php/official/provision/bootstrap.d/11-php-conf.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -PHP_CLEAR_ENV_AVAILABLE=1 - PHP_ETC_DIR=/usr/local/etc/php PHP_MAIN_CONF=/usr/local/etc/php-fpm.conf PHP_POOL_CONF=www.conf diff --git a/tests/structure-test/php/test.yaml b/tests/structure-test/php/test.yaml index 28363b985..581a5b0e2 100644 --- a/tests/structure-test/php/test.yaml +++ b/tests/structure-test/php/test.yaml @@ -35,10 +35,10 @@ fileExistenceTests: - name: 'PIE working directory was removed after the build' path: '/tmp/pie' shouldExist: false - - name: 'provision: set php version variable script was deleted after execution' + - name: 'provision: image family script was deleted after execution' path: '/opt/docker/provision/bootstrap.d/10-php-init.sh' shouldExist: false - - name: 'provision: set permission script was deleted after execution' + - name: 'provision: PHP path variables script was deleted after execution' path: '/opt/docker/provision/bootstrap.d/11-php-conf.sh' shouldExist: false - name: 'provision: cron installer was deleted after enabling the service' From e35bc7acacbd5e0c17603874e5c480541e41500a Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 13:58:40 +0000 Subject: [PATCH 09/17] [BUGFIX] Start Nginx and PHP-FPM without IPv6 Nginx listens on [::]:80 and [::]:443, PHP-FPM in php, php-dev, php-nginx-dev and php-apache-dev on [::]:9000. Without IPv6 in the container both failed with "Address family not supported by protocol" and supervisord restarted them over and over. If /proc/net/if_inet6 does not exist, the start scripts now remove the listen [::] lines from the Nginx files and let PHP-FPM listen on 0.0.0.0 instead of [::]. With IPv6 nothing changes. A file that cannot be changed, for example one mounted read-only, gets a warning instead of stopping the container. The known issue is removed; the image pages say how Nginx and PHP-FPM listen, and the configuration file section mentions read-only Nginx files with listen [::]. --- .../alpine/conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../8.2-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.2/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.3-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.3/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.4-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.4/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.5-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.5/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.2-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.2/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.3-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.3/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.4-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.4/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.5-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.5/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.2-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.2/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.3-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.3/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.4-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.4/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.5-alpine/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../8.5/conf/provision/bootstrap.d/10-php.sh | 3 ++- .../conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../8.2/conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../8.3/conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../8.4/conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../8.5/conf/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../conf/provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../conf/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ .../conf/provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../8.2/conf/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ .../conf/provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../conf/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ .../conf/provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../8.3/conf/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ .../conf/provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../conf/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ .../conf/provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../8.4/conf/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ .../conf/provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../conf/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ .../conf/provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../8.5/conf/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ docs/customization.md | 1 + docs/images/nginx.md | 2 +- docs/images/php-apache.md | 2 +- docs/images/php-nginx.md | 2 +- docs/images/php.md | 2 +- docs/known-issues.md | 13 ------------- .../general/provision/entrypoint.d/20-nginx.sh | 12 ++++++++++++ .../php-dev/general/provision/bootstrap.d/10-php.sh | 3 ++- .../provision/bootstrap.d/20-setup-php-fpm.sh | 3 ++- .../general/provision/entrypoint.d/20-php-fpm.sh | 12 ++++++++++++ 59 files changed, 301 insertions(+), 51 deletions(-) diff --git a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi diff --git a/docs/customization.md b/docs/customization.md index 44254316a..f9deebe86 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -279,6 +279,7 @@ Files with other extensions are left alone. The files are rewritten in place, wh - A file without placeholders can be mounted `:ro`. - A file with placeholders must not be mounted `:ro`: the file cannot be rewritten, and the container exits with code 2 at start. - A file with placeholders that is mounted read-write is rewritten on the host as well; after the first start it contains the values instead of the placeholders. +- If the container has no IPv6, the `listen [::]` lines are removed from the Nginx files at start. In a file mounted `:ro` they cannot be removed, and Nginx does not start; leave them out of such a file. Use `COPY` in a Dockerfile for files with placeholders. diff --git a/docs/images/nginx.md b/docs/images/nginx.md index d6365bcb8..af70b9dc8 100644 --- a/docs/images/nginx.md +++ b/docs/images/nginx.md @@ -25,6 +25,6 @@ services: - ./:/app ``` -Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Started by default: `nginx`. Without IPv6 in the container, Nginx does not start and is restarted over and over; [Known issues](../known-issues.md#nginx-and-php-fpm-without-ipv6) has a start script that fixes it. +Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Started by default: `nginx`. Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. Settings: [Web server](../environment-variables.md#web-server) (`WEB_PHP_SOCKET` is empty, there is no PHP), hooks in `/opt/docker/bin/service.d/nginx.d`, see [Customization](../customization.md). diff --git a/docs/images/php-apache.md b/docs/images/php-apache.md index 5fcf045db..0a4063f7f 100644 --- a/docs/images/php-apache.md +++ b/docs/images/php-apache.md @@ -24,7 +24,7 @@ Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for ` ## Services -Started by default: `apache`, `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. In `php-apache-dev`, PHP-FPM does not start without IPv6 in the container, see [Known issues](../known-issues.md#nginx-and-php-fpm-without-ipv6). +Started by default: `apache`, `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. ## Configuration diff --git a/docs/images/php-nginx.md b/docs/images/php-nginx.md index ea7acbef4..6550592ef 100644 --- a/docs/images/php-nginx.md +++ b/docs/images/php-nginx.md @@ -20,7 +20,7 @@ services: - ./:/app ``` -Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Without IPv6 in the container, Nginx (and in `php-nginx-dev` also PHP-FPM) does not start and is restarted over and over; [Known issues](../known-issues.md#nginx-and-php-fpm-without-ipv6) has a start script that fixes it. +Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. ## Services diff --git a/docs/images/php.md b/docs/images/php.md index 9a832a189..3f6317fbe 100644 --- a/docs/images/php.md +++ b/docs/images/php.md @@ -29,7 +29,7 @@ PHP-FPM listens on port `9000`. For a web server in the same container use [`php ## Services -Started by default: `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. See [Customization](../customization.md#services). PHP-FPM listens on `[::]:9000`; without IPv6 in the container it does not start, see [Known issues](../known-issues.md#nginx-and-php-fpm-without-ipv6). +Started by default: `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. See [Customization](../customization.md#services). PHP-FPM listens on `[::]:9000`; if the container has no IPv6, it listens on `0.0.0.0:9000`. ## PHP configuration diff --git a/docs/known-issues.md b/docs/known-issues.md index cd965e89f..b1b3718ff 100644 --- a/docs/known-issues.md +++ b/docs/known-issues.md @@ -88,19 +88,6 @@ These options and tools are part of the images but do not work, or work only in - **Images:** `php-nginx` and `php-nginx-dev` with the Debian tags `8.2` to `8.5`. - **Instead:** Add your own repositories as a new file in `/etc/apt/sources.list.d/`, for example `echo "deb http://deb.debian.org/debian bookworm-backports main" > /etc/apt/sources.list.d/backports.list`. -### Nginx and PHP-FPM without IPv6 - -- **Effect:** If the container has no IPv6, Nginx cannot listen on `[::]:80` and `[::]:443`, and PHP-FPM cannot listen on `[::]:9000` (`Address family not supported by protocol`). supervisord restarts them over and over. -- **Images:** Nginx in `php-nginx`, `php-nginx-dev` and `nginx`. PHP-FPM in `php`, `php-dev`, `php-nginx-dev` and `php-apache-dev`; in `php-nginx` and `php-apache` it listens on `127.0.0.1:9000` and is not affected. -- **Instead:** Change the listen addresses in a [start script](customization.md#scripts-at-container-start), for example `/entrypoint.d/10-no-ipv6.sh`: - - ```sh - for f in $(grep -rlE 'listen \[::\]|listen = \[::\]' /opt/docker/etc/nginx /opt/docker/etc/php/fpm 2>/dev/null); do - sed -i -e '/^\s*listen \[::\]/d' -e 's/^listen = \[::\]:9000/listen = 0.0.0.0:9000/' "$f" - done - true - ``` - ### Xdebug settings written into `php.ini` - **Effect:** When an `XDEBUG_*` variable is set, the development images append its setting to `/opt/docker/etc/php/php.ini`, your own file. A read-write mount gets one more line on every start of the container, also on the host; with a `:ro` mount the container exits at start. diff --git a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh index 0264b6c2e..7238aa62f 100644 --- a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh +++ b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh @@ -22,3 +22,15 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/conf.d/10-php.conf rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi + +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then + echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" + fi + fi + done +fi diff --git a/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh b/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh index 1d1d33fb2..27172ba1f 100644 --- a/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh +++ b/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh @@ -5,7 +5,8 @@ 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 all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh index d37088954..e528980b0 100644 --- a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,7 +18,8 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses +# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, +# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. go-replace --mode=line --regex \ -s '^[\s;]*listen[\s]*=' -r 'listen = [::]:9000' \ --path=/opt/docker/etc/php/fpm/ \ diff --git a/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh b/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh index 5ab722cf7..607cf9ac5 100644 --- a/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh +++ b/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh @@ -78,3 +78,15 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi + +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +if [[ ! -e /proc/net/if_inet6 ]]; then + for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do + if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then + echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" + if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" + fi + fi + done +fi From 9655c6f46d1f95910a99bd9d7c387331bdef21ca Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 13:58:40 +0000 Subject: [PATCH 10/17] [TASK] Make make structure-test strict and check sponge on Debian - tests/structure-test/run.sh tests only the tags that the CI builds (the -t "webdevops/..." lines in build.yaml), so old local tags no longer fail the run. It fails if docker cannot list the images or if no image was tested, instead of exiting 0. - base-app::moreutils also runs on Debian, so the PHP images on Debian check sponge as well. - The build tools known issue names which images the CI tests and shows make structure-test as the local check; AGENTS.md describes the new behaviour. --- AGENTS.md | 2 +- docs/known-issues.md | 2 +- .../spec/shared/base-app/moreutils.rb | 2 +- tests/structure-test/run.sh | 39 ++++++++++++++++--- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 667fb24c0..b9b02c1fb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,7 +23,7 @@ Only these commands are known to work: - `docker build -t webdevops/: docker//` builds one image; its parent and `webdevops/toolbox` come from local images or Docker Hub. - `./build-local.sh [version]` builds all PHP images of one version. -Besides `provision`, the Makefile has `graph` and `graph-full` (also Python 2, inside `webdevops/dockerfile-build-env`), `structure-test` and `setup`, which the `webdevops/dockerfile-build-env` image runs while it is built. `make structure-test` runs container-structure-test against your local images of `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`, the images that have a suite in `tests/structure-test`; run it inside `webdevops/dockerfile-build-env` with the Docker socket mounted. The CI runs serverspec for every image except `toolbox` and `dockerfile-build-env`, and container-structure-test for the six images above; to check a change by hand, start the image and try it as described below. +Besides `provision`, the Makefile has `graph` and `graph-full` (also Python 2, inside `webdevops/dockerfile-build-env`), `structure-test` and `setup`, which the `webdevops/dockerfile-build-env` image runs while it is built. `make structure-test` runs container-structure-test against your local images of `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`, the images that have a suite in `tests/structure-test`. It tests only the tags in `.github/workflows/build.yaml` and fails if a test fails, if `docker` fails or if no such image exists locally; run it inside `webdevops/dockerfile-build-env` with the Docker socket mounted. The CI runs serverspec for every image except `toolbox` and `dockerfile-build-env`, and container-structure-test for the six images above; to check a change by hand, start the image and try it as described below. ## Keep the documentation up to date diff --git a/docs/known-issues.md b/docs/known-issues.md index b1b3718ff..87eb235ca 100644 --- a/docs/known-issues.md +++ b/docs/known-issues.md @@ -134,7 +134,7 @@ These options and tools are part of the images but do not work, or work only in ## Build tools - **Effect:** The Makefile targets `provision`, `graph` and `graph-full` call `bin/console`, which needs Python 2. On a host without Python 2 they fail with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env` they work. -- **Instead:** Run `make provision` in `webdevops/dockerfile-build-env` as shown in the [README](../README.md#file-generation). Build images with `docker build` or `./build-local.sh`, see [Building and testing locally](../README.md#building-and-testing-locally). The CI runs the serverspec and structure tests for every image. +- **Instead:** Run `make provision` in `webdevops/dockerfile-build-env` as shown in the [README](../README.md#file-generation). Build images with `docker build` or `./build-local.sh`, see [Building and testing locally](../README.md#building-and-testing-locally). The CI runs the serverspec tests for every image except `toolbox` and `dockerfile-build-env`, and the structure tests for `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`. To run the structure tests against the images you built locally, use `docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v $PWD:/app -w /app webdevops/dockerfile-build-env make structure-test`. It tests the local tags that the CI builds and fails if no such image exists. - **Issue:** [#549](https://github.com/webdevops/Dockerfile/issues/549) (move away from Python 2). ## Migration from older images diff --git a/tests/serverspec/spec/shared/base-app/moreutils.rb b/tests/serverspec/spec/shared/base-app/moreutils.rb index 92bab99f7..88c0f3ddb 100644 --- a/tests/serverspec/spec/shared/base-app/moreutils.rb +++ b/tests/serverspec/spec/shared/base-app/moreutils.rb @@ -1,5 +1,5 @@ shared_examples 'base-app::moreutils' do - describe command('command -v sponge'), :if => os[:family] == 'ubuntu' do + describe command('command -v sponge'), :if => ['debian', 'ubuntu'].include?(os[:family]) do its(:stdout) { should eq "/usr/bin/sponge\n" } its(:exit_status) { should eq 0 } end diff --git a/tests/structure-test/run.sh b/tests/structure-test/run.sh index b95df05d5..60fd34721 100755 --- a/tests/structure-test/run.sh +++ b/tests/structure-test/run.sh @@ -1,29 +1,58 @@ #!/bin/bash -# Runs container-structure-test against every local webdevops image that has a suite in this directory. -# Exits non-zero if any image fails. +# Runs container-structure-test against the local webdevops images that have a suite in this directory. +# Only the tags the CI builds are tested (the -t "webdevops/..." lines in .github/workflows/build.yaml); +# tags that are not built locally are skipped. +# Exits non-zero if a test fails, if docker cannot list the images or if no image was tested. cd "$(dirname "$0")" || exit 1 +BUILD_YAML="../../.github/workflows/build.yaml" + +if [[ ! -f "$BUILD_YAML" ]]; then + echo "ERROR: $BUILD_YAML not found" >&2 + exit 1 +fi + +if ! LOCAL_IMAGES="$(docker images --format '{{.Repository}}:{{.Tag}}')"; then + echo "ERROR: docker images failed" >&2 + exit 1 +fi + FAILED=0 +TESTED=0 + for testRepo in */; do testRepo="${testRepo%/}" + if [[ ! -f "$testRepo/test.yaml" ]]; then continue fi - TEST_IMAGES="$(docker images -f "reference=webdevops/${testRepo}" --format "{{.Tag}}")" - for imageTag in ${TEST_IMAGES}; do - if [ "$imageTag" = "" ]; then + + BUILT_TAGS="$(grep -oE "\"webdevops/${testRepo}:[^\"]+\"" "$BUILD_YAML" | tr -d '"' | cut -d ':' -f 2 | sort -u)" + + for imageTag in ${BUILT_TAGS}; do + if ! grep -qxF "webdevops/$testRepo:$imageTag" <<< "$LOCAL_IMAGES"; then continue fi + echo "==============================================" echo "Testing: webdevops/$testRepo:$imageTag" echo "==============================================" + CONFIGS=(--config "$testRepo/test.yaml") if [[ -f "$testRepo/$imageTag/test.yaml" ]]; then CONFIGS+=(--config "$testRepo/$imageTag/test.yaml") fi + + TESTED=$((TESTED + 1)) container-structure-test test --image "webdevops/$testRepo:$imageTag" "${CONFIGS[@]}" || FAILED=1 done done +if [[ "$TESTED" -eq 0 ]]; then + echo "ERROR: no image was tested. Build at least one tag of these images first:" $(ls -d */ | tr -d '/') >&2 + exit 1 +fi + +echo "Tested $TESTED images" exit $FAILED From 93bc20e697f7e337649566c3f1f9eb41090088db Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 15:13:29 +0000 Subject: [PATCH 11/17] [BUGFIX] Rewrite mounted files in place in the IPv6 fallback sed -i writes a temporary file and renames it over the original. For a single file mounted read-write, for example ./vhost.conf mounted to /opt/docker/etc/nginx/vhost.conf, the rename fails with "Device or resource busy", so Nginx still did not start without IPv6. A file in a mounted directory was replaced by a new file. The start scripts now write the result back into the same file, as go-replace does for the placeholders. In a read-write mount the listen lines change on the host as well; a file mounted :ro still gets the warning, and Nginx or PHP-FPM does not start. --- .../alpine/conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../8.2/conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../8.3/conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../8.4/conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../8.5/conf/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- .../8.2/conf/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- .../8.3/conf/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- .../8.4/conf/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- .../8.5/conf/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- docs/customization.md | 4 ++-- .../nginx/general/provision/entrypoint.d/20-nginx.sh | 11 +++++++++-- .../php/general/provision/entrypoint.d/20-php-fpm.sh | 11 +++++++++-- 20 files changed, 173 insertions(+), 40 deletions(-) diff --git a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/docs/customization.md b/docs/customization.md index f9deebe86..525890fa3 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -279,7 +279,7 @@ Files with other extensions are left alone. The files are rewritten in place, wh - A file without placeholders can be mounted `:ro`. - A file with placeholders must not be mounted `:ro`: the file cannot be rewritten, and the container exits with code 2 at start. - A file with placeholders that is mounted read-write is rewritten on the host as well; after the first start it contains the values instead of the placeholders. -- If the container has no IPv6, the `listen [::]` lines are removed from the Nginx files at start. In a file mounted `:ro` they cannot be removed, and Nginx does not start; leave them out of such a file. +- If the container has no IPv6, the `listen [::]` lines are removed from the Nginx files at start. In a file mounted read-write they are removed on the host as well; in a file mounted `:ro` they cannot be removed, and Nginx does not start. Use `COPY` in a Dockerfile for files with placeholders. @@ -294,7 +294,7 @@ Images: `php-*`. Files in `/opt/docker/etc/php/`: | `php.webdevops.ini` | The image's PHP defaults, followed by the values of the `php.*` and `PHP_*` variables. Loaded as `98-webdevops.ini`. At every start it is reset to the image's version and the variables are written again, so do not replace or edit it. | | `php.ini` | For your settings, empty by default. Loaded as `99-docker.ini`, after `98-webdevops.ini`, so its values win over the environment variables. A `:ro` mount works, except in the development images when one of the [`XDEBUG_*` variables](environment-variables.md#development-images) is set: these images write the Xdebug settings into this file, and with `:ro` the container exits at start. | | `fpm/php-fpm.conf` | PHP-FPM main configuration; `FPM_PROCESS_MAX` and `fpm.global.*` are appended at every start. | -| `fpm/pool.d/application.conf` | The PHP-FPM pool `[www]`; the `FPM_*` and `fpm.pool.*` values are appended at every start. To replace it, use `COPY` in a Dockerfile: with a `:ro` mount the container exits at start, and a read-write mount gets the values appended in the file on the host. | +| `fpm/pool.d/application.conf` | The PHP-FPM pool `[www]`; the `FPM_*` and `fpm.pool.*` values are appended at every start. To replace it, use `COPY` in a Dockerfile: with a `:ro` mount the container exits at start, and a read-write mount gets the values appended in the file on the host. Without IPv6 in the container, `listen = [::]:9000` is also changed to `0.0.0.0:9000` there. | `PHP_SENDMAIL_PATH` is the exception to the order above. It is also written into the pool as `php_admin_value[sendmail_path]`, and it is always set (default `/usr/sbin/sendmail -t -i`). So for requests handled by PHP-FPM, `sendmail_path` in your `php.ini` has no effect; only the PHP CLI uses it. Set `PHP_SENDMAIL_PATH` instead. diff --git a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh index 7238aa62f..accfb489c 100644 --- a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh +++ b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh @@ -23,14 +23,21 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only +# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi diff --git a/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh b/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh index 607cf9ac5..76de0402e 100644 --- a/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh +++ b/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh @@ -79,14 +79,21 @@ if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses +# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. +# The file is rewritten in place (not with sed -i), so mounted files keep working. if [[ ! -e /proc/net/if_inet6 ]]; then for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - if ! sed -i -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE"; then + TMP_FILE="" + if ! { TMP_FILE="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ + && cat "$TMP_FILE" > "$FILE"; }; then echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" fi + if [[ -n "$TMP_FILE" ]]; then + rm -f -- "$TMP_FILE" + fi fi done fi From 39bd24012be5fd709f086ce7beec23e98d947a96 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 20:36:48 +0000 Subject: [PATCH 12/17] [BUGFIX] Leave mounted Nginx files alone, let PHP-FPM fall back to IPv4 PHP-FPM listens on the port only (listen = 9000) instead of [::]:9000. PHP-FPM then binds to :: itself and falls back to 0.0.0.0 if the container has no IPv6, so the rewrite at start is gone. With IPv6 the socket is the same as before: neither form sets IPV6_V6ONLY. Without IPv6, the Nginx start script now changes only files in the container's own file system, such as the image's vhost.conf and files added with COPY. Mounted files (bind mounts, volumes, ConfigMaps) are never changed, so a developer without IPv6 does not lose the listen [::] lines in the project; a warning names the file instead. Warnings go to stderr, because the provisioning output is discarded unless the container runs supervisord or noop. The loop reads find -print0 with its own variable names instead of overwriting FILE of includeScriptDir, follows symlinks (ConfigMaps), and skips hidden directories such as ..data, so every file is handled once. --- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.2/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.3/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.4/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.5/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.2/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.3/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.4/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.5/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.2/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.3/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.4/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/bootstrap.d/10-php.sh | 6 +-- .../8.5/conf/provision/bootstrap.d/10-php.sh | 6 +-- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../conf/provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 19 ------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 19 ------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 19 ------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 19 ------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 19 ------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 19 ------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 19 ------- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../conf/provision/entrypoint.d/20-php-fpm.sh | 19 ------- docs/customization.md | 4 +- docs/images/nginx.md | 2 +- docs/images/php-nginx.md | 2 +- docs/images/php.md | 2 +- .../provision/entrypoint.d/20-nginx.sh | 53 ++++++++++++++----- .../general/provision/bootstrap.d/10-php.sh | 6 +-- .../provision/bootstrap.d/20-setup-php-fpm.sh | 6 +-- .../provision/entrypoint.d/20-php-fpm.sh | 19 ------- 57 files changed, 497 insertions(+), 418 deletions(-) diff --git a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-apache-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.2-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.2/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.3-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.3/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.4-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.4/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.5-alpine/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh +++ b/docker/php-nginx-dev/8.5/conf/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.2-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi diff --git a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.2/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.2/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi diff --git a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.3-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi diff --git a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.3/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.3/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi diff --git a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.4-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi diff --git a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.4/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.4/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi diff --git a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5-alpine/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.5-alpine/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi diff --git a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/docker/php-official/8.5/conf/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh b/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh +++ b/docker/php-official/8.5/conf/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi diff --git a/docs/customization.md b/docs/customization.md index 525890fa3..d914bfffe 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -279,7 +279,7 @@ Files with other extensions are left alone. The files are rewritten in place, wh - A file without placeholders can be mounted `:ro`. - A file with placeholders must not be mounted `:ro`: the file cannot be rewritten, and the container exits with code 2 at start. - A file with placeholders that is mounted read-write is rewritten on the host as well; after the first start it contains the values instead of the placeholders. -- If the container has no IPv6, the `listen [::]` lines are removed from the Nginx files at start. In a file mounted read-write they are removed on the host as well; in a file mounted `:ro` they cannot be removed, and Nginx does not start. +- If the container has no IPv6, the `listen [::]` lines are removed at start from the Nginx files in the container, including files you add with `COPY`. Mounted files are never changed: if a mounted file contains `listen [::]`, Nginx does not start without IPv6, and a warning names the file. Use `COPY` in a Dockerfile for files with placeholders. @@ -294,7 +294,7 @@ Images: `php-*`. Files in `/opt/docker/etc/php/`: | `php.webdevops.ini` | The image's PHP defaults, followed by the values of the `php.*` and `PHP_*` variables. Loaded as `98-webdevops.ini`. At every start it is reset to the image's version and the variables are written again, so do not replace or edit it. | | `php.ini` | For your settings, empty by default. Loaded as `99-docker.ini`, after `98-webdevops.ini`, so its values win over the environment variables. A `:ro` mount works, except in the development images when one of the [`XDEBUG_*` variables](environment-variables.md#development-images) is set: these images write the Xdebug settings into this file, and with `:ro` the container exits at start. | | `fpm/php-fpm.conf` | PHP-FPM main configuration; `FPM_PROCESS_MAX` and `fpm.global.*` are appended at every start. | -| `fpm/pool.d/application.conf` | The PHP-FPM pool `[www]`; the `FPM_*` and `fpm.pool.*` values are appended at every start. To replace it, use `COPY` in a Dockerfile: with a `:ro` mount the container exits at start, and a read-write mount gets the values appended in the file on the host. Without IPv6 in the container, `listen = [::]:9000` is also changed to `0.0.0.0:9000` there. | +| `fpm/pool.d/application.conf` | The PHP-FPM pool `[www]`; the `FPM_*` and `fpm.pool.*` values are appended at every start. To replace it, use `COPY` in a Dockerfile: with a `:ro` mount the container exits at start, and a read-write mount gets the values appended in the file on the host. | `PHP_SENDMAIL_PATH` is the exception to the order above. It is also written into the pool as `php_admin_value[sendmail_path]`, and it is always set (default `/usr/sbin/sendmail -t -i`). So for requests handled by PHP-FPM, `sendmail_path` in your `php.ini` has no effect; only the PHP CLI uses it. Set `PHP_SENDMAIL_PATH` instead. diff --git a/docs/images/nginx.md b/docs/images/nginx.md index af70b9dc8..9b8828b97 100644 --- a/docs/images/nginx.md +++ b/docs/images/nginx.md @@ -25,6 +25,6 @@ services: - ./:/app ``` -Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Started by default: `nginx`. Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. +Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Started by default: `nginx`. Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. A mounted configuration file with `listen [::]` is not changed, see [Configuration files](../customization.md#configuration-files). Settings: [Web server](../environment-variables.md#web-server) (`WEB_PHP_SOCKET` is empty, there is no PHP), hooks in `/opt/docker/bin/service.d/nginx.d`, see [Customization](../customization.md). diff --git a/docs/images/php-nginx.md b/docs/images/php-nginx.md index 6550592ef..bfada502c 100644 --- a/docs/images/php-nginx.md +++ b/docs/images/php-nginx.md @@ -20,7 +20,7 @@ services: - ./:/app ``` -Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. +Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. A mounted configuration file with `listen [::]` is not changed, see [Configuration files](../customization.md#configuration-files). ## Services diff --git a/docs/images/php.md b/docs/images/php.md index 3f6317fbe..044fb312e 100644 --- a/docs/images/php.md +++ b/docs/images/php.md @@ -29,7 +29,7 @@ PHP-FPM listens on port `9000`. For a web server in the same container use [`php ## Services -Started by default: `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. See [Customization](../customization.md#services). PHP-FPM listens on `[::]:9000`; if the container has no IPv6, it listens on `0.0.0.0:9000`. +Started by default: `php-fpm`, `cron`, `syslog`. The `-dev` variant also starts `postfix` and `ssh`. See [Customization](../customization.md#services). PHP-FPM listens on port `9000` of all IPv6 and IPv4 addresses; if the container has no IPv6, of all IPv4 addresses. ## PHP configuration diff --git a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh index accfb489c..de7bc9838 100644 --- a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh +++ b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh @@ -24,20 +24,45 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then fi # Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# The file is rewritten in place (not with sed -i), so mounted files keep working. +# Only files in the container's own file system are changed. Mounted files (bind mounts, +# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/nginx/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$FILE"; then - echo "IPv6 is not available, removing the IPv6 listen directives from $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; nginx will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi + NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" + NGINX_CONF_SEEN="" + # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps + # the files of a ConfigMap there (..data) behind the visible symlinks + while IFS= read -r -d '' NGINX_CONF; do + # Handle every file once, also when it is reachable through several symlinks + NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" + case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac + NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' + + if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then + continue + fi + + NGINX_CONF_MOUNTED=0 + while IFS= read -r NGINX_MOUNT; do + case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac + done <<< "$NGINX_MOUNTS" + + if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then + echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 + continue + fi + + echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" + # Rewrite in place, so a symlinked file keeps its link + NGINX_CONF_TMP="" + if ! { NGINX_CONF_TMP="$(mktemp)" \ + && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ + && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then + echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 + fi + if [[ -n "$NGINX_CONF_TMP" ]]; then + rm -f -- "$NGINX_CONF_TMP" fi - done + done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) + unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN fi diff --git a/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh b/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh index 27172ba1f..d100a7e41 100644 --- a/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh +++ b/provisioning/php-dev/general/provision/bootstrap.d/10-php.sh @@ -5,9 +5,9 @@ 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 all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh index e528980b0..9f96894b1 100644 --- a/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh +++ b/provisioning/php/general/provision/bootstrap.d/20-setup-php-fpm.sh @@ -18,9 +18,9 @@ go-replace --mode=lineinfile --regex \ -s '^[\s;]*pid[\s]*=' -r 'pid = /var/run/php-fpm.pid' \ -- /opt/docker/etc/php/fpm/php-fpm.conf -# Listen on all IPv6 and IPv4 addresses. Without IPv6 in the container, -# entrypoint.d/20-php-fpm.sh switches to 0.0.0.0:9000 at start. +# 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' \ + -s '^[\s;]*listen[\s]*=' -r 'listen = 9000' \ --path=/opt/docker/etc/php/fpm/ \ --path-pattern='*.conf' diff --git a/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh b/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh index 76de0402e..5ab722cf7 100644 --- a/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh +++ b/provisioning/php/general/provision/entrypoint.d/20-php-fpm.sh @@ -78,22 +78,3 @@ fi if [[ -n "${PHP_SENDMAIL_PATH+x}" ]]; then echo "php_admin_value[sendmail_path] = ${PHP_SENDMAIL_PATH}" >> /opt/docker/etc/php/fpm/pool.d/application.conf fi - -# Without IPv6 in the container PHP-FPM cannot listen on [::], so it listens on all IPv4 addresses. -# The file is rewritten in place (not with sed -i), so mounted files keep working. -if [[ ! -e /proc/net/if_inet6 ]]; then - for FILE in $(find /opt/docker/etc/php/fpm/ -type f -name '*.conf'); do - if grep -qE '^[[:space:]]*listen[[:space:]]*=[[:space:]]*\[::\]:' "$FILE"; then - echo "IPv6 is not available, PHP-FPM listens on 0.0.0.0 instead of [::] in $FILE" - TMP_FILE="" - if ! { TMP_FILE="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]*=/ s/\[::\]:/0.0.0.0:/' "$FILE" > "$TMP_FILE" \ - && cat "$TMP_FILE" > "$FILE"; }; then - echo "WARNING: Cannot change $FILE; PHP-FPM will not start without IPv6" - fi - if [[ -n "$TMP_FILE" ]]; then - rm -f -- "$TMP_FILE" - fi - fi - done -fi From 3795e88c4b1cc54208ed0246f494f648dce29c90 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 20:38:28 +0000 Subject: [PATCH 13/17] [TASK] Test identical images once in make structure-test latest and ubuntu-22.04 of bootstrap, base and base-app are the same image; run.sh tested them twice when both tags existed locally. A tag whose image and suites were already tested is now skipped with a note. The error message for "no image tested" lists the suites from an array instead of an unquoted $(ls ...) (shellcheck SC2046). --- tests/structure-test/run.sh | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/tests/structure-test/run.sh b/tests/structure-test/run.sh index 60fd34721..a9f372bf8 100755 --- a/tests/structure-test/run.sh +++ b/tests/structure-test/run.sh @@ -1,7 +1,8 @@ #!/bin/bash # Runs container-structure-test against the local webdevops images that have a suite in this directory. # Only the tags the CI builds are tested (the -t "webdevops/..." lines in .github/workflows/build.yaml); -# tags that are not built locally are skipped. +# tags that are not built locally are skipped, and a tag that is the same image as one already tested +# with the same suites (for example latest and ubuntu-22.04) is tested once. # Exits non-zero if a test fails, if docker cannot list the images or if no image was tested. cd "$(dirname "$0")" || exit 1 @@ -13,13 +14,16 @@ if [[ ! -f "$BUILD_YAML" ]]; then exit 1 fi -if ! LOCAL_IMAGES="$(docker images --format '{{.Repository}}:{{.Tag}}')"; then +# ": " per line +if ! LOCAL_IMAGES="$(docker images --no-trunc --format '{{.Repository}}:{{.Tag}} {{.ID}}')"; then echo "ERROR: docker images failed" >&2 exit 1 fi FAILED=0 TESTED=0 +SUITES=() +declare -A TESTED_AS for testRepo in */; do testRepo="${testRepo%/}" @@ -27,30 +31,40 @@ for testRepo in */; do if [[ ! -f "$testRepo/test.yaml" ]]; then continue fi + SUITES+=("$testRepo") - BUILT_TAGS="$(grep -oE "\"webdevops/${testRepo}:[^\"]+\"" "$BUILD_YAML" | tr -d '"' | cut -d ':' -f 2 | sort -u)" + mapfile -t BUILT_TAGS < <(grep -oE "\"webdevops/${testRepo}:[^\"]+\"" "$BUILD_YAML" | tr -d '"' | cut -d ':' -f 2 | sort -u) - for imageTag in ${BUILT_TAGS}; do - if ! grep -qxF "webdevops/$testRepo:$imageTag" <<< "$LOCAL_IMAGES"; then + for imageTag in "${BUILT_TAGS[@]}"; do + image="webdevops/$testRepo:$imageTag" + imageId="$(awk -v image="$image" '$1 == image { print $2; exit }' <<< "$LOCAL_IMAGES")" + if [[ -z "$imageId" ]]; then continue fi - echo "==============================================" - echo "Testing: webdevops/$testRepo:$imageTag" - echo "==============================================" - CONFIGS=(--config "$testRepo/test.yaml") if [[ -f "$testRepo/$imageTag/test.yaml" ]]; then CONFIGS+=(--config "$testRepo/$imageTag/test.yaml") fi + testKey="$imageId ${CONFIGS[*]}" + if [[ -n "${TESTED_AS[$testKey]:-}" ]]; then + echo "Skipping $image: same image and suites as ${TESTED_AS[$testKey]}" + continue + fi + TESTED_AS[$testKey]="$image" + + echo "==============================================" + echo "Testing: $image" + echo "==============================================" + TESTED=$((TESTED + 1)) - container-structure-test test --image "webdevops/$testRepo:$imageTag" "${CONFIGS[@]}" || FAILED=1 + container-structure-test test --image "$image" "${CONFIGS[@]}" || FAILED=1 done done if [[ "$TESTED" -eq 0 ]]; then - echo "ERROR: no image was tested. Build at least one tag of these images first:" $(ls -d */ | tr -d '/') >&2 + echo "ERROR: no image was tested. Build at least one tag of these images first: ${SUITES[*]}" >&2 exit 1 fi From f2df52f1d8825ad572f6832107e2823cea921178 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 20:57:12 +0000 Subject: [PATCH 14/17] [TASK] Remove the image graph generation Since #596 the documentation shows how the images build on each other as a Mermaid diagram; nothing uses the Graphviz image anymore. Removed: conf/diagram.yml, the generate:graph command and its registration in bin/console, the Makefile targets graph and graph-full, imagePath and graph.label in conf/console.yml (and imagePath in the path list of bin/console and the defaults of Configuration.py), graphviz in bin/requirements.txt and in the dockerfile-build-env image, and /graph in .gitignore. README, AGENTS.md and the build tools known issue name make provision as the only Python 2 target. --- .gitignore | 1 - AGENTS.md | 4 +- Makefile | 9 +- README.md | 4 +- bin/command/generate_graph_command.py | 248 ------------------ bin/console | 3 - bin/requirements.txt | 1 - bin/webdevops/Configuration.py | 1 - conf/console.yml | 5 - conf/diagram.yml | 123 --------- docker/dockerfile-build-env/latest/Dockerfile | 1 - .../latest/Dockerfile.jinja2 | 1 - docs/known-issues.md | 2 +- 13 files changed, 6 insertions(+), 397 deletions(-) delete mode 100644 bin/command/generate_graph_command.py delete mode 100644 conf/diagram.yml diff --git a/.gitignore b/.gitignore index b6932fd0a..d64af3b3b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ *.log *.pyc .doit.db -/graph diff --git a/AGENTS.md b/AGENTS.md index b9b02c1fb..8c4b1a3f9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,7 +8,7 @@ | `docker///Dockerfile.jinja2` | Per-image template (source) | | `provisioning/` | Scripts and configuration files copied into the images (source); `conf/provision.yml` says which go where | | `docker///Dockerfile`, `docker///conf/` | Generated by `make provision`, never edited by hand | -| `bin/` | Old Python 2 tools behind `make provision`, `make graph` and `make graph-full` | +| `bin/` | Old Python 2 tools behind `make provision` | | `ci/` | PHP generator for `.github/workflows/build.yaml` (`ci/console github:generate-ci`) | | `tests/` | serverspec (Ruby) and container-structure-test definitions run by the CI | | `docs/` | User documentation | @@ -23,7 +23,7 @@ Only these commands are known to work: - `docker build -t webdevops/: docker//` builds one image; its parent and `webdevops/toolbox` come from local images or Docker Hub. - `./build-local.sh [version]` builds all PHP images of one version. -Besides `provision`, the Makefile has `graph` and `graph-full` (also Python 2, inside `webdevops/dockerfile-build-env`), `structure-test` and `setup`, which the `webdevops/dockerfile-build-env` image runs while it is built. `make structure-test` runs container-structure-test against your local images of `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`, the images that have a suite in `tests/structure-test`. It tests only the tags in `.github/workflows/build.yaml` and fails if a test fails, if `docker` fails or if no such image exists locally; run it inside `webdevops/dockerfile-build-env` with the Docker socket mounted. The CI runs serverspec for every image except `toolbox` and `dockerfile-build-env`, and container-structure-test for the six images above; to check a change by hand, start the image and try it as described below. +Besides `provision`, the Makefile has `structure-test` and `setup`, which the `webdevops/dockerfile-build-env` image runs while it is built. `make structure-test` runs container-structure-test against your local images of `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`, the images that have a suite in `tests/structure-test`. It tests only the tags in `.github/workflows/build.yaml` and fails if a test fails, if `docker` fails or if no such image exists locally; run it inside `webdevops/dockerfile-build-env` with the Docker socket mounted. The CI runs serverspec for every image except `toolbox` and `dockerfile-build-env`, and container-structure-test for the six images above; to check a change by hand, start the image and try it as described below. ## Keep the documentation up to date diff --git a/Makefile b/Makefile index 7773a52a4..486234952 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ MAKEFLAGS += --silent -.PHONY: list setup requirements structure-test provision graph graph-full +.PHONY: list setup requirements structure-test provision list: sh -c "echo; $(MAKE) -p no_targets__ 2>/dev/null |\ @@ -20,10 +20,3 @@ structure-test: provision: python2 bin/console generate:dockerfile python2 bin/console generate:provision - -graph: - python2 ./bin/console generate:graph - -graph-full: - python2 ./bin/console generate:graph --all\ - --filename docker-image-full-layout.gv diff --git a/README.md b/README.md index 5085433ca..96a7ab626 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,8 @@ Build all PHP images of one version (default `8.5`), in the order they depend on ./build-local.sh 8.4 ``` -Then try an image with the quick start above. `make provision`, `make graph` and `make graph-full` call `bin/console`, which needs Python 2; -run them inside `webdevops/dockerfile-build-env`. See [Known issues](docs/known-issues.md#build-tools). +Then try an image with the quick start above. `make provision` calls `bin/console`, which needs Python 2; +run it inside `webdevops/dockerfile-build-env`. See [Known issues](docs/known-issues.md#build-tools). ### PHP extension builds diff --git a/bin/command/generate_graph_command.py b/bin/command/generate_graph_command.py deleted file mode 100644 index 1a82ee378..000000000 --- a/bin/command/generate_graph_command.py +++ /dev/null @@ -1,248 +0,0 @@ -#!/usr/bin/env/python -# -*- coding: utf-8 -*- -# -# (c) 2016 WebDevOps.io -# -# This file is part of Dockerfile Repository. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -# documentation files (the "Software"), to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and -# to permit persons to whom the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all copies or substantial portions -# of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -import os -import re -import yaml -from datetime import date -from graphviz import Digraph -from cleo import Output -from webdevops import DockerfileUtility -from webdevops.command import BaseCommand -from cleo.validators import Enum - -class GenerateGraphCommand(BaseCommand): - """ - Generate a diagram of container - - generate:graph - {--a|all : Show all informations} - {--o|output= : path output} - {--F|format=png (choice) : output format } - {--f|filename=docker-image-layout.gv : file output} - """ - - validation = { - '--format': Enum(['png', 'jpg', 'pdf', 'svg']) - } - - from_regex = re.compile(ur'FROM\s+(?P[^\s:]+)(:(?P.+))?', re.MULTILINE) - - containers = {} - - tags = {} - - subgraph = {} - - edges = {} - - conf = '' - - def run_task(self, configuration): - if self.option('output'): - configuration.set('imagePath', self.option('output')) - - if Output.VERBOSITY_VERBOSE <= self.output.get_verbosity(): - self.line('ALL : %s' % self.option('all')) - self.line('output : %s' % configuration.get('imagePath')) - self.line('format : %s' % self.option('format')) - self.line('dockerPath : %s' % configuration.get('dockerPath')) - self.line('filename : %s' % self.option('filename')) - self.__load_configuration() - - dockerfileList = DockerfileUtility.find_dockerfiles_in_path( - base_path=configuration.get('dockerPath'), - path_regex=configuration.get('docker.pathRegex'), - image_prefix=configuration.get('docker.imagePrefix'), - ) - - for dockerfile in dockerfileList: - self.__process_dockerfile(dockerfile) - - dia = self.build_graph() - dia.render() - - def __process_dockerfile(self, dockerfile): - """ - - :param dockerfile_full_path: - :type dockerfile_full_path: str - - :return: self - :rtype: self - """ - - if Output.VERBOSITY_VERBOSE <= self.output.get_verbosity(): - self.line('-> Processing: %s' % dockerfile['image']['fullname']) - - docker_image = dockerfile['image']['name'] - parent_image_name = DockerfileUtility.image_basename(dockerfile['image']['from']) - parent_image_tag = DockerfileUtility.extract_image_name_tag(dockerfile['image']['from']) - - if not parent_image_name in self.containers: - self.containers[parent_image_name] = 'scratch' - self.__append_tag(parent_image_name, 'latest') - - self.containers[docker_image] = parent_image_name - self.__append_tag(docker_image, parent_image_tag) - - return self - - def __append_tag(self, docker_image, tag): - """ - - :param docker_image: - :type docker_image: str - - :param tag: - :type tag: str - - :return: self - """ - if not self.tags.has_key(docker_image): - self.tags[docker_image] = {} - self.tags[docker_image][tag] = tag - return self - - def __get_graph(self, default_graph, name): - """ - - :param default_graph: Main diagram - :type default_graph: Digraph - - :param name: Name of the sub-diagram - :type name: str - - :return: the selected diagram - :rtype: Digraph - """ - for group, group_attr in self.conf['diagram']['groups'].items(): - for dockerRegex in group_attr['docker']: - if re.match(dockerRegex, name): - return group, self.subgraph[group] - return '__root__', default_graph - - def __load_configuration(self): - conf_file_path = os.path.join(self.configuration.get('confPath'), 'diagram.yml') - - stream = open(conf_file_path, 'r') - self.conf = yaml.safe_load(stream) - - def __apply_styles(self, graph, styles): - """ - - :param graph: Diagraph to apply styles - :type graph Digraph - - :param styles: Styles properties of Diagraph - :type styles: dict - - :return: The GRaph with Style - :rtype: Digraph - """ - graph.graph_attr.update( - ('graph' in styles and styles['graph']) or {} - ) - graph.node_attr.update( - ('nodes' in styles and styles['nodes']) or {} - ) - graph.edge_attr.update( - ('edges' in styles and styles['edges']) or {} - ) - return graph - - def build_graph(self): - """ - - :return: the graph - :rtype: Digraph - """ - dia = Digraph('webdevops', - filename=self.option('filename'), - format=self.option('format'), - directory=self.configuration.get('imagePath') - ) - dia = self.__apply_styles(dia, self.conf['diagram']['styles']) - - label = r'label = "\n\n%s"' % self.configuration.get('graph.label') - - dia.body.append(label % date.today().strftime("%Y-%m-%d")) - dia.body.append('newrank=true;') - - rank_image_list = {} - rank_group_list = {} - - # Create subgraph - for group, group_attr in self.conf['diagram']['groups'].items(): - self.subgraph[group] = Digraph('cluster_%s' % group) - self.subgraph[group].body.append(r'label = "%s"' % group_attr['name']) - self.subgraph[group] = self.__apply_styles(self.subgraph[group], group_attr['styles']) - - if 'rank' in group_attr: - rank_group_list[group] = group_attr['rank'] - - for image, base in self.containers.items(): - group_image, graph_image = self.__get_graph(dia, image) - group_base, graph_base = self.__get_graph(dia, base) - if not "scratch" in base: - if graph_image == graph_base: - graph_image.edge(base, image) - else: - graph_image.node(image) - self.edges[image] = base - if self.option('all'): - self.__attach_tag(graph_image, image) - else: - graph_image.node(image) - - if group_image in rank_group_list: - image_rank = rank_group_list[group_image] - - if not image_rank in rank_image_list: - rank_image_list[image_rank] = [] - - rank_image_list[image_rank].append(image) - - # add repositories (subgraph/cluster) - for name, subgraph in self.subgraph.items(): - dia.subgraph(subgraph) - - # add images (node) - for image, base in self.edges.items(): - dia.edge(base, image) - - # add invisible constraints to add ranked groups - for rank, imagelist in rank_image_list.items(): - rank_next = rank + 1 - - if rank_next in rank_image_list: - imagelist_next = rank_image_list[rank_next] - - for image in imagelist: - for image_next in imagelist_next: - dia.body.append('{ "%s" -> "%s" [style=invis] }' % (image, image_next)) - - return dia - - def __attach_tag(self, graph, image): - for tag in self.tags[image]: - node_name = "%s-%s" % (image, tag) - graph.node(node_name, label=tag, fillcolor='#eeeeee', shape='folder') - graph.edge(image, node_name) diff --git a/bin/console b/bin/console index 0ec2645a0..ebf5b10b2 100755 --- a/bin/console +++ b/bin/console @@ -24,7 +24,6 @@ from command.docker_exec_command import DockerExecCommand from command.test_testinfra_command import TestTestinfraCommand from command.test_serverspec_command import TestServerspecCommand from command.generate_dockerfile_command import GenerateDockerfileCommand -from command.generate_graph_command import GenerateGraphCommand from command.generate_provision_command import GenerateProvisionCommand if __name__ == '__main__': @@ -63,7 +62,6 @@ if __name__ == '__main__': 'dockerPath', 'templatePath', 'provisionPath', - 'imagePath', 'baselayoutPath', 'testinfraPath', 'serverspecPath', @@ -98,7 +96,6 @@ if __name__ == '__main__': application.add(TestTestinfraCommand(configuration=configuration)) application.add(TestServerspecCommand(configuration=configuration)) application.add(GenerateDockerfileCommand(configuration=configuration)) - application.add(GenerateGraphCommand(configuration=configuration)) application.add(GenerateProvisionCommand(configuration=configuration)) application.run() diff --git a/bin/requirements.txt b/bin/requirements.txt index 0a1be6eca..4ca4bcc6d 100644 --- a/bin/requirements.txt +++ b/bin/requirements.txt @@ -1,5 +1,4 @@ Jinja2>=2.8 -graphviz>=0.4.10 cleo<0.7.0 yamlordereddictloader>=0.1.0 testinfra>=1.4.2 diff --git a/bin/webdevops/Configuration.py b/bin/webdevops/Configuration.py index 3d6cfad25..e9f69d61f 100644 --- a/bin/webdevops/Configuration.py +++ b/bin/webdevops/Configuration.py @@ -26,7 +26,6 @@ 'dockerPath': False, 'templatePath': False, 'provisionPath': False, - 'imagePath': False, 'confPath': False, 'baselayoutPath': False, 'testPath': False, diff --git a/conf/console.yml b/conf/console.yml index 344029c93..8456af4c7 100644 --- a/conf/console.yml +++ b/conf/console.yml @@ -3,7 +3,6 @@ dockerPath: 'docker' templatePath: 'template' provisionPath: 'provisioning' -imagePath: 'graph/' baselayoutPath: 'baselayout' testinfraPath: 'tests/testinfra' serverspecPath: 'tests/serverspec' @@ -17,10 +16,6 @@ docker: autoPull: True autoPullBlacklist: '^webdevops/.*' - -graph: - label: 'Webdevops Images\n%s' - dockerTest: serverspec: specPath: 'spec/docker/%s_spec.rb' diff --git a/conf/diagram.yml b/conf/diagram.yml deleted file mode 100644 index cf5644cf5..000000000 --- a/conf/diagram.yml +++ /dev/null @@ -1,123 +0,0 @@ ---- -diagram: - styles: - graph: - fontsize: "16" - fontcolor: black - bgcolor: white - rankdir: TP - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: white - style: filled - fillcolor: "#E1E1E1" - edges: - style: dashed - color: black - arrowhead: open - fontname: Courier - fontsize: "12" - fontcolor: white - groups: - official: - name: Official images (Docker hub) - rank: 1 - styles: - graph: - style: dashed - fillcolor: gray - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#e1e1e1" - docker: - - "^[^/]+$" - upstream: - name: Upstream images (Docker hub) - rank: 1 - styles: - graph: - style: dashed - fillcolor: gray - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#e1e1e1" - docker: - - "^(?!webdevops)[^/]+/[^/]+" - base: - name: Base images - rank: 2 - styles: - graph: - style: filled - fillcolor: gray - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#e1e1e1" - docker: - - webdevops/bootstrap - - webdevops/base.* - php: - name: PHP images - rank: 3 - styles: - graph: - style: filled - fillcolor: "#c0e5a8" - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#78c445" - docker: - - webdevops/php - - webdevops/php-apache - - webdevops/php-nginx - php-dev: - name: PHP development images - rank: 4 - styles: - graph: - style: filled - fillcolor: "#c0e5a8" - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#78c445" - docker: - - webdevops/php.*-dev - service: - name: Service images - rank: 3 - styles: - graph: - style: filled - fillcolor: "#fbd3b5" - nodes: - fontname: Helvetica - shape: box - fontcolor: black - color: black - style: filled - fillcolor: "#ffa35f" - docker: - - webdevops/apache - - webdevops/nginx diff --git a/docker/dockerfile-build-env/latest/Dockerfile b/docker/dockerfile-build-env/latest/Dockerfile index 610e71e73..e1c2b3f26 100644 --- a/docker/dockerfile-build-env/latest/Dockerfile +++ b/docker/dockerfile-build-env/latest/Dockerfile @@ -16,7 +16,6 @@ RUN apt-install \ python2 \ python2-dev \ python-setuptools \ - graphviz \ ruby \ ruby-dev \ ruby-bundler \ diff --git a/docker/dockerfile-build-env/latest/Dockerfile.jinja2 b/docker/dockerfile-build-env/latest/Dockerfile.jinja2 index 31120da94..a16d2e34a 100644 --- a/docker/dockerfile-build-env/latest/Dockerfile.jinja2 +++ b/docker/dockerfile-build-env/latest/Dockerfile.jinja2 @@ -11,7 +11,6 @@ RUN apt-install \ python2 \ python2-dev \ python-setuptools \ - graphviz \ ruby \ ruby-dev \ ruby-bundler \ diff --git a/docs/known-issues.md b/docs/known-issues.md index 87eb235ca..6d57c5565 100644 --- a/docs/known-issues.md +++ b/docs/known-issues.md @@ -133,7 +133,7 @@ These options and tools are part of the images but do not work, or work only in ## Build tools -- **Effect:** The Makefile targets `provision`, `graph` and `graph-full` call `bin/console`, which needs Python 2. On a host without Python 2 they fail with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env` they work. +- **Effect:** The Makefile target `provision` calls `bin/console`, which needs Python 2. On a host without Python 2 it fails with `python2: No such file or directory`. Inside `webdevops/dockerfile-build-env` it works. - **Instead:** Run `make provision` in `webdevops/dockerfile-build-env` as shown in the [README](../README.md#file-generation). Build images with `docker build` or `./build-local.sh`, see [Building and testing locally](../README.md#building-and-testing-locally). The CI runs the serverspec tests for every image except `toolbox` and `dockerfile-build-env`, and the structure tests for `bootstrap`, `base`, `base-app`, `php`, `php-dev` and `php-nginx`. To run the structure tests against the images you built locally, use `docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v $PWD:/app -w /app webdevops/dockerfile-build-env make structure-test`. It tests the local tags that the CI builds and fails if no such image exists. - **Issue:** [#549](https://github.com/webdevops/Dockerfile/issues/549) (move away from Python 2). From 1e4a19ce61cf424de04252a73a29d8371be5fef7 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 21:09:44 +0000 Subject: [PATCH 15/17] [TASK] Keep the Nginx IPv6 listen directives in their own files Nginx has no fallback like PHP-FPM: listen [::] fails without IPv6, also with ipv6only=off. Instead of searching all configuration files and leaving mounted ones alone, the two listen [::] directives of the default vhost now live in vhost.ipv6/listen-80.conf and listen-443.conf. vhost.conf includes them with a wildcard, so missing files are fine, and the start script only deletes these files if the container has no IPv6. No other file is changed; a file of one's own with listen [::] keeps nginx from starting without IPv6, as before. --- docker/nginx/alpine/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- .../8.2-alpine/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- .../php-nginx/8.2/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- .../8.3-alpine/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- .../php-nginx/8.3/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- .../8.4-alpine/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- .../php-nginx/8.4/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- .../8.5-alpine/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- .../php-nginx/8.5/conf/etc/nginx/vhost.conf | 6 ++- .../conf/etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../conf/etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../conf/provision/entrypoint.d/20-nginx.sh | 44 ++----------------- docs/customization.md | 4 +- docs/images/nginx.md | 2 +- docs/images/php-nginx.md | 2 +- .../nginx/general/etc/nginx/vhost.conf | 6 ++- .../etc/nginx/vhost.ipv6/listen-443.conf | 1 + .../etc/nginx/vhost.ipv6/listen-80.conf | 1 + .../provision/entrypoint.d/20-nginx.sh | 44 ++----------------- 43 files changed, 95 insertions(+), 433 deletions(-) create mode 100644 docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-80.conf create mode 100644 provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-443.conf create mode 100644 provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-80.conf diff --git a/docker/nginx/alpine/conf/etc/nginx/vhost.conf b/docker/nginx/alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/nginx/alpine/conf/etc/nginx/vhost.conf +++ b/docker/nginx/alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/nginx/alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/nginx/alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.2-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docker/php-nginx/8.2/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.2/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.2/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.2/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.2/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.2/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.3-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docker/php-nginx/8.3/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.3/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.3/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.3/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.3/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.3/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.4-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docker/php-nginx/8.4/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.4/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.4/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.4/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.4/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.4/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.5-alpine/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5-alpine/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docker/php-nginx/8.5/conf/etc/nginx/vhost.conf b/docker/php-nginx/8.5/conf/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/docker/php-nginx/8.5/conf/etc/nginx/vhost.conf +++ b/docker/php-nginx/8.5/conf/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-443.conf b/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-80.conf b/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/docker/php-nginx/8.5/conf/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh +++ b/docker/php-nginx/8.5/conf/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi diff --git a/docs/customization.md b/docs/customization.md index d914bfffe..38cafe979 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -233,6 +233,7 @@ Images: `php-nginx`, `php-nginx-dev`, `nginx`. The distribution's configuration | `global.conf` | Empty; for your settings at `http` level | | `conf.d/*.conf` | Settings at `http` level. `conf.d/10-php.conf` defines the upstream `php` (`WEB_PHP_SOCKET`). | | `vhost.conf` | The default server for port 80 and port 443: `server_name`, `root`, `index`. Both include `vhost.common.d/*.conf`; port 443 also includes `vhost.ssl.conf`. | +| `vhost.ipv6/listen-80.conf`, `vhost.ipv6/listen-443.conf` | `listen [::]:80` and `listen [::]:443` for the default server, included by `vhost.conf`. Deleted at start if the container has no IPv6, so the default server listens on IPv4 only. | | `vhost.ssl.conf` | TLS protocols, ciphers and the paths of `ssl/server.crt` and `ssl/server.key` | | `vhost.common.d/10-general.conf` | `client_max_body_size` (`SERVICE_NGINX_CLIENT_MAX_BODY_SIZE`) | | `vhost.common.d/10-location-root.conf` | `location /` with `try_files $uri $uri/ /?$query_string` | @@ -279,12 +280,13 @@ Files with other extensions are left alone. The files are rewritten in place, wh - A file without placeholders can be mounted `:ro`. - A file with placeholders must not be mounted `:ro`: the file cannot be rewritten, and the container exits with code 2 at start. - A file with placeholders that is mounted read-write is rewritten on the host as well; after the first start it contains the values instead of the placeholders. -- If the container has no IPv6, the `listen [::]` lines are removed at start from the Nginx files in the container, including files you add with `COPY`. Mounted files are never changed: if a mounted file contains `listen [::]`, Nginx does not start without IPv6, and a warning names the file. Use `COPY` in a Dockerfile for files with placeholders. If `WEB_PHP_SOCKET` is empty, the files that connect the web server to PHP-FPM are deleted at start: `conf.d/10-php.conf` and `vhost.common.d/10-php.conf` (Nginx), `conf.d/10-php.conf` (Apache). This is the default in `nginx` and `apache`. +If the container has no IPv6, the files in `vhost.ipv6/` are deleted at start (Nginx); if you mount `/opt/docker/etc/nginx/` as a whole, also on the host. No other file is changed: a file of your own with `listen [::]` keeps Nginx from starting without IPv6. + ### PHP Images: `php-*`. Files in `/opt/docker/etc/php/`: diff --git a/docs/images/nginx.md b/docs/images/nginx.md index 9b8828b97..3f53e42ba 100644 --- a/docs/images/nginx.md +++ b/docs/images/nginx.md @@ -25,6 +25,6 @@ services: - ./:/app ``` -Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Started by default: `nginx`. Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. A mounted configuration file with `listen [::]` is not changed, see [Configuration files](../customization.md#configuration-files). +Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Started by default: `nginx`. Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. Your own configuration files with `listen [::]` are not changed, see [Configuration files](../customization.md#configuration-files). Settings: [Web server](../environment-variables.md#web-server) (`WEB_PHP_SOCKET` is empty, there is no PHP), hooks in `/opt/docker/bin/service.d/nginx.d`, see [Customization](../customization.md). diff --git a/docs/images/php-nginx.md b/docs/images/php-nginx.md index bfada502c..ab754fd29 100644 --- a/docs/images/php-nginx.md +++ b/docs/images/php-nginx.md @@ -20,7 +20,7 @@ services: - ./:/app ``` -Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. A mounted configuration file with `listen [::]` is not changed, see [Configuration files](../customization.md#configuration-files). +Ports: `80` (HTTP) and `443` (HTTPS). HTTPS uses a self-signed certificate for `*.vm` that ships with the image; it expired on 2025-05-01. To use your own certificate, see [Configuration files](../customization.md#configuration-files). Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. Your own configuration files with `listen [::]` are not changed, see [Configuration files](../customization.md#configuration-files). ## Services diff --git a/provisioning/nginx/general/etc/nginx/vhost.conf b/provisioning/nginx/general/etc/nginx/vhost.conf index b4df6d710..8836f5e3a 100644 --- a/provisioning/nginx/general/etc/nginx/vhost.conf +++ b/provisioning/nginx/general/etc/nginx/vhost.conf @@ -1,6 +1,7 @@ server { listen 80 default_server; - listen [::]:80 default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf; server_name _ docker; @@ -16,7 +17,8 @@ server { server { listen 443 ssl default_server; - listen [::]:443 ssl default_server; + # IPv6; the files are deleted at start if the container has no IPv6 + include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf; server_name _ docker; diff --git a/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-443.conf b/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-443.conf new file mode 100644 index 000000000..17937e4b2 --- /dev/null +++ b/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-443.conf @@ -0,0 +1 @@ +listen [::]:443 ssl default_server; diff --git a/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-80.conf b/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-80.conf new file mode 100644 index 000000000..f2632c6d9 --- /dev/null +++ b/provisioning/nginx/general/etc/nginx/vhost.ipv6/listen-80.conf @@ -0,0 +1 @@ +listen [::]:80 default_server; diff --git a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh index de7bc9838..cefd9a4fd 100644 --- a/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh +++ b/provisioning/nginx/general/provision/entrypoint.d/20-nginx.sh @@ -23,46 +23,8 @@ if [[ -z "$WEB_PHP_SOCKET" ]]; then rm -f -- /opt/docker/etc/nginx/vhost.common.d/10-php.conf fi -# Without IPv6 in the container nginx cannot listen on [::], so it listens on IPv4 only. -# Only files in the container's own file system are changed. Mounted files (bind mounts, -# volumes, ConfigMaps) are left alone, so a file in the user's project is never changed. +# Without IPv6 in the container nginx cannot listen on [::]: delete the IPv6 listen +# directives that vhost.conf includes, so nginx listens on IPv4 only if [[ ! -e /proc/net/if_inet6 ]]; then - NGINX_MOUNTS="$(awk '$5 != "/" { print $5 }' /proc/self/mountinfo)" - NGINX_CONF_SEEN="" - # Hidden directories are skipped: nginx does not include them, and Kubernetes keeps - # the files of a ConfigMap there (..data) behind the visible symlinks - while IFS= read -r -d '' NGINX_CONF; do - # Handle every file once, also when it is reachable through several symlinks - NGINX_CONF_REAL="$(readlink -f "$NGINX_CONF")" - case "$NGINX_CONF_SEEN" in *$'\n'"$NGINX_CONF_REAL"$'\n'*) continue ;; esac - NGINX_CONF_SEEN="$NGINX_CONF_SEEN"$'\n'"$NGINX_CONF_REAL"$'\n' - - if ! grep -qE '^[[:space:]]*listen[[:space:]]+\[::\]' "$NGINX_CONF"; then - continue - fi - - NGINX_CONF_MOUNTED=0 - while IFS= read -r NGINX_MOUNT; do - case "$NGINX_CONF" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - case "$NGINX_CONF_REAL" in "$NGINX_MOUNT"|"$NGINX_MOUNT"/*) NGINX_CONF_MOUNTED=1 ;; esac - done <<< "$NGINX_MOUNTS" - - if [[ "$NGINX_CONF_MOUNTED" -eq 1 ]]; then - echo "WARNING: IPv6 is not available, but $NGINX_CONF is mounted and contains listen [::]; nginx will not start" >&2 - continue - fi - - echo "IPv6 is not available, removing the IPv6 listen directives from $NGINX_CONF" - # Rewrite in place, so a symlinked file keeps its link - NGINX_CONF_TMP="" - if ! { NGINX_CONF_TMP="$(mktemp)" \ - && sed -E '/^[[:space:]]*listen[[:space:]]+\[::\]/d' "$NGINX_CONF" > "$NGINX_CONF_TMP" \ - && cat "$NGINX_CONF_TMP" > "$NGINX_CONF"; }; then - echo "WARNING: Cannot change $NGINX_CONF; nginx will not start without IPv6" >&2 - fi - if [[ -n "$NGINX_CONF_TMP" ]]; then - rm -f -- "$NGINX_CONF_TMP" - fi - done < <(find -L /opt/docker/etc/nginx/ -mindepth 1 -name '.*' -prune -o -type f -name '*.conf' -print0) - unset NGINX_MOUNTS NGINX_MOUNT NGINX_CONF NGINX_CONF_REAL NGINX_CONF_MOUNTED NGINX_CONF_TMP NGINX_CONF_SEEN + rm -f -- /opt/docker/etc/nginx/vhost.ipv6/*.conf || true fi From 40a78212995b41bb7e50f3bcea685fb80e6a1d74 Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 21:34:50 +0000 Subject: [PATCH 16/17] [TASK] Check the IPv6 listen files in nginx::layout serverspec now checks the vhost.ipv6 directory, that vhost.conf includes listen-80.conf and listen-443.conf, and the two files with their listen [::] directives, so the CI notices if they are missing in an image. The start script deletes the files if the kernel has no IPv6; serverspec runs on the Docker host, which shares its kernel with the container, so without IPv6 the test expects the files to be gone. --- tests/serverspec/spec/shared/nginx/layout.rb | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/serverspec/spec/shared/nginx/layout.rb b/tests/serverspec/spec/shared/nginx/layout.rb index 26db619a2..626f6d06b 100644 --- a/tests/serverspec/spec/shared/nginx/layout.rb +++ b/tests/serverspec/spec/shared/nginx/layout.rb @@ -6,6 +6,7 @@ "/opt/docker/etc/nginx", "/opt/docker/etc/nginx/conf.d", "/opt/docker/etc/nginx/vhost.common.d", + "/opt/docker/etc/nginx/vhost.ipv6", "/opt/docker/bin/service.d/nginx.d", ].each do |file| describe file("#{file}") do @@ -102,6 +103,46 @@ end end + ######################### + ## IPv6 listen directives of the default vhost + ######################### + # The start script deletes them if the kernel has no IPv6. Serverspec runs on + # the Docker host, which shares its kernel with the container. + ipv6_available = File.exist?('/proc/net/if_inet6') + + describe file('/opt/docker/etc/nginx/vhost.conf') do + its(:content) { should include 'include /opt/docker/etc/nginx/vhost.ipv6/listen-80*.conf;' } + its(:content) { should include 'include /opt/docker/etc/nginx/vhost.ipv6/listen-443*.conf;' } + end + + { + "/opt/docker/etc/nginx/vhost.ipv6/listen-80.conf" => "listen [::]:80 default_server;", + "/opt/docker/etc/nginx/vhost.ipv6/listen-443.conf" => "listen [::]:443 ssl default_server;", + }.each do |file, directive| + describe file("#{file}"), :if => ipv6_available do + it { should be_file } + its(:content) { should include directive } + + # Owner test + it { should be_owned_by 'root' } + it { should be_grouped_into 'root' } + + # Read test + it { should be_readable.by('owner') } + it { should be_readable.by('group') } + it { should be_readable.by('others') } + + # Exectuable test + it { should_not be_executable.by('owner') } + it { should_not be_executable.by('group') } + it { should_not be_executable.by('others') } + end + + describe file("#{file}"), :unless => ipv6_available do + it { should_not exist } + end + end + ######################### ## SSL (special rights) ######################### From 96498309a3f0025f51afb7a42bb04a38a20eaf5b Mon Sep 17 00:00:00 2001 From: Matthias Vogel Date: Sun, 8 Nov 2026 21:34:50 +0000 Subject: [PATCH 17/17] [TASK] Stop run.sh with a clear message on Bash 3 run.sh uses declare -A and mapfile, which need Bash 4. With the Bash 3.2 of macOS, make structure-test failed with "declare: -A: invalid option" and "mapfile: command not found". The script now checks the version first and points to webdevops/dockerfile-build-env, and it runs the first bash in PATH instead of /bin/bash. --- tests/structure-test/run.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/structure-test/run.sh b/tests/structure-test/run.sh index a9f372bf8..b5ae5fbad 100755 --- a/tests/structure-test/run.sh +++ b/tests/structure-test/run.sh @@ -1,9 +1,16 @@ -#!/bin/bash +#!/usr/bin/env bash # Runs container-structure-test against the local webdevops images that have a suite in this directory. # Only the tags the CI builds are tested (the -t "webdevops/..." lines in .github/workflows/build.yaml); # tags that are not built locally are skipped, and a tag that is the same image as one already tested # with the same suites (for example latest and ubuntu-22.04) is tested once. # Exits non-zero if a test fails, if docker cannot list the images or if no image was tested. +# Needs Bash 4 or newer (declare -A, mapfile). + +if (( BASH_VERSINFO[0] < 4 )); then + echo "ERROR: run.sh needs Bash 4 or newer, this is Bash $BASH_VERSION." >&2 + echo "Run make structure-test inside webdevops/dockerfile-build-env, or put a newer bash first in PATH." >&2 + exit 1 +fi cd "$(dirname "$0")" || exit 1