Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 24 additions & 24 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7148,7 +7148,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.2
context: docker/php/8.2
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.2'
Expand All @@ -7164,7 +7164,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.2
context: docker/php/8.2
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.2'
Expand Down Expand Up @@ -7210,7 +7210,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.2
context: docker/php/8.2
platforms: '${{ matrix.platform }}'
cache-from: 'type=gha,scope=webdevops/php:8.2-${{ matrix.arch }}'
cache-to: 'type=gha,scope=webdevops/php:8.2-${{ matrix.arch }},mode=max'
Expand Down Expand Up @@ -7273,7 +7273,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.2-alpine
context: docker/php/8.2-alpine
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.2-alpine'
Expand All @@ -7289,7 +7289,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.2-alpine
context: docker/php/8.2-alpine
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.2-alpine'
Expand Down Expand Up @@ -7335,7 +7335,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.2-alpine
context: docker/php/8.2-alpine
platforms: '${{ matrix.platform }}'
cache-from: 'type=gha,scope=webdevops/php:8.2-alpine-${{ matrix.arch }}'
cache-to: 'type=gha,scope=webdevops/php:8.2-alpine-${{ matrix.arch }},mode=max'
Expand Down Expand Up @@ -7474,7 +7474,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.3
context: docker/php/8.3
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.3'
Expand All @@ -7490,7 +7490,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.3
context: docker/php/8.3
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.3'
Expand Down Expand Up @@ -7536,7 +7536,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.3
context: docker/php/8.3
platforms: '${{ matrix.platform }}'
cache-from: 'type=gha,scope=webdevops/php:8.3-${{ matrix.arch }}'
cache-to: 'type=gha,scope=webdevops/php:8.3-${{ matrix.arch }},mode=max'
Expand Down Expand Up @@ -7599,7 +7599,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.3-alpine
context: docker/php/8.3-alpine
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.3-alpine'
Expand All @@ -7615,7 +7615,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.3-alpine
context: docker/php/8.3-alpine
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.3-alpine'
Expand Down Expand Up @@ -7661,7 +7661,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.3-alpine
context: docker/php/8.3-alpine
platforms: '${{ matrix.platform }}'
cache-from: 'type=gha,scope=webdevops/php:8.3-alpine-${{ matrix.arch }}'
cache-to: 'type=gha,scope=webdevops/php:8.3-alpine-${{ matrix.arch }},mode=max'
Expand Down Expand Up @@ -7800,7 +7800,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.4
context: docker/php/8.4
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.4'
Expand All @@ -7816,7 +7816,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.4
context: docker/php/8.4
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.4'
Expand Down Expand Up @@ -7862,7 +7862,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.4
context: docker/php/8.4
platforms: '${{ matrix.platform }}'
cache-from: 'type=gha,scope=webdevops/php:8.4-${{ matrix.arch }}'
cache-to: 'type=gha,scope=webdevops/php:8.4-${{ matrix.arch }},mode=max'
Expand Down Expand Up @@ -7925,7 +7925,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.4-alpine
context: docker/php/8.4-alpine
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.4-alpine'
Expand All @@ -7941,7 +7941,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.4-alpine
context: docker/php/8.4-alpine
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.4-alpine'
Expand Down Expand Up @@ -7987,7 +7987,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.4-alpine
context: docker/php/8.4-alpine
platforms: '${{ matrix.platform }}'
cache-from: 'type=gha,scope=webdevops/php:8.4-alpine-${{ matrix.arch }}'
cache-to: 'type=gha,scope=webdevops/php:8.4-alpine-${{ matrix.arch }},mode=max'
Expand Down Expand Up @@ -8126,7 +8126,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.5
context: docker/php/8.5
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.5'
Expand All @@ -8142,7 +8142,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.5
context: docker/php/8.5
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.5'
Expand Down Expand Up @@ -8188,7 +8188,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.5
context: docker/php/8.5
platforms: '${{ matrix.platform }}'
cache-from: 'type=gha,scope=webdevops/php:8.5-${{ matrix.arch }}'
cache-to: 'type=gha,scope=webdevops/php:8.5-${{ matrix.arch }},mode=max'
Expand Down Expand Up @@ -8251,7 +8251,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.5-alpine
context: docker/php/8.5-alpine
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.5-alpine'
Expand All @@ -8267,7 +8267,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.5-alpine
context: docker/php/8.5-alpine
platforms: '${{ matrix.platform }}'
load: true
tags: 'ghcr.io/webdevops/php:sha-${{ github.sha }}-${{ matrix.arch }}-8.5-alpine'
Expand Down Expand Up @@ -8313,7 +8313,7 @@ jobs:
env:
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GITHUB_TOKEN }}"}}'
with:
context: docker/php-official/8.5-alpine
context: docker/php/8.5-alpine
platforms: '${{ matrix.platform }}'
cache-from: 'type=gha,scope=webdevops/php:8.5-alpine-${{ matrix.arch }}'
cache-to: 'type=gha,scope=webdevops/php:8.5-alpine-${{ matrix.arch }},mode=max'
Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
| `tests/` | container-structure-test definitions run by the CI |
| `docs/` | User documentation |

`docker/php/<version>` are symlinks to `docker/php-official/<version>`, kept by `ci/console generate:dockerfile`; both images are built from the same Dockerfiles. The tags that are built are the `-t "webdevops/..."` lines in `.github/workflows/build.yaml`.
`webdevops/php-official` is a deprecated name of `webdevops/php`: the CI publishes the image of `docker/php/<tag>` under that name too, but only for the tags listed under `docker: aliases` in `conf/console.yml`. Do not add new tags there. The tags that are built are the `-t "webdevops/..."` lines in `.github/workflows/build.yaml`.

## Build and test

Expand Down Expand Up @@ -56,7 +56,7 @@ Where the documentation lives:
| `docs/customization.md` | Commands, scripts at start and build time, tools for your Dockerfile, services, cron jobs and their time zone, healthcheck, configuration files and placeholders, supervisord, locales, application user and changing its UID |
| `docs/images/*.md` | One page per image family: tags, base image, services, settings, development variant. `php.md` also has Debian or Alpine, production, installing extensions, mail and Xdebug with an IDE |
| `docs/known-issues.md` | Options and tools that do not work, with affected images and workaround; migration from older images |
| `docs/discontinued-images.md` | Replacements for images that are no longer built (`storage`, `vsftp`, `ssh`) |
| `docs/discontinued-images.md` | Replacements for images that are no longer built (`storage`, `vsftp`, `ssh`) or deprecated (`php-official`) |

### When to update it

Expand Down Expand Up @@ -95,7 +95,7 @@ Update the documentation whenever a change touches any of these:

4. **Document only what works.** Never describe an option that has no effect as working. Fix it, or leave it out and list it in `docs/known-issues.md`. If it works only in some images, say exactly which. Anything `docs/known-issues.md` lists as not working must never appear as working anywhere else. An `ENV` line or a script that reads a variable is no proof that it works: `SERVICE_POSTFIX_OPTS` is passed to `postfix start`, which ignores it. When you fix a known issue, remove its entry in the same pull request.

5. **Keep lists in sync.** The tag lists in `README.md` and in `docs/images/*.md` must match the tags pushed by `.github/workflows/build.yaml`. The README banner follows the built tags by itself when you run `ci/console generate:readme-banner`; change its texts in `conf/readme-banner.yml`. `webdevops/php-official` is not listed in the README; it is built from the same Dockerfiles as `webdevops/php`. The defaults in `docs/environment-variables.md` must match what a container reports.
5. **Keep lists in sync.** The tag lists in `README.md` and in `docs/images/*.md` must match the tags pushed by `.github/workflows/build.yaml`. The README banner follows the built tags by itself when you run `ci/console generate:readme-banner`; change its texts in `conf/readme-banner.yml`. `webdevops/php-official` is not listed in the README; it is a deprecated name of `webdevops/php`. The defaults in `docs/environment-variables.md` must match what a container reports.

6. **Follow the style.**
- English, GitHub Markdown, relative links, diagrams as Mermaid. No documentation tooling.
Expand Down
8 changes: 5 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The container runs as your user, so the files it writes belong to you.

| Command | Writes |
| --- | --- |
| `ci/console generate:dockerfile` | `docker/<image>/<tag>/Dockerfile` from the `Dockerfile.twig` next to it and the Twig templates in the `template` directory, and the links `docker/php/<version>` to `docker/php-official/<version>` |
| `ci/console generate:dockerfile` | `docker/<image>/<tag>/Dockerfile` from the `Dockerfile.twig` next to it and the Twig templates in the `template` directory |
| `ci/console generate:provision` | `docker/<image>/<tag>/conf/` from the `provisioning` directory, as configured in `conf/provision.yml` |
| `ci/console generate:github-ci` | `.github/workflows/build.yaml`, a build and a publish job for every Dockerfile |
| `ci/console generate:readme-banner` | `docs/assets/readme-banner-*.svg` |
Expand All @@ -30,7 +30,9 @@ A `Dockerfile.twig` imports the macros it uses from `template/Dockerfile`, e.g.
The commands that the images have in `/usr/local/bin`, such as `apt-install`, `apk-install`, `docker-run-bootstrap` and `generate-locales`, are in `provisioning/baselayout/general/usr/local/bin`. They only handle Debian, Ubuntu and Alpine, the systems the images are built on. `generate:provision` copies them into `docker/toolbox/latest/conf/`, `toolbox` keeps them under `/baselayout`, and `bootstrap` and the PHP images copy them from there with `COPY --from=webdevops/toolbox`.
It checks all of `conf/provision.yml` before it changes a file and stops if a source directory or a tag does not exist, or if an image has another setting than `configuration`.
`generate:dockerfile` stops if a directory `docker/<image>/<tag>` has files but no `Dockerfile.twig`; it first removes the `.DS_Store` files of the macOS Finder under `docker`.
To stop building a tag, remove its directory and those of the tags that build on it; `generate:github-ci` names any it finds. `generate:dockerfile` adds and removes the links in `docker/php` along with the `php-official` tags.
To stop building a tag, remove its directory and those of the tags that build on it; `generate:github-ci` names any it finds.

`webdevops/php-official` is a deprecated name of `webdevops/php`. `generate:github-ci` publishes a `php` tag under that name too only if `docker: aliases` in `conf/console.yml` lists it; new PHP versions are not added there. When you stop building a `php` tag, remove it from that list as well: `generate:github-ci` stops while the list names a tag without a Dockerfile in `docker/php`, or while a tag directory in `docker/php-official` has a Dockerfile.

## Building in CI

Expand Down Expand Up @@ -111,7 +113,7 @@ A container counts as started once its entrypoint has run its scripts and starte
| `ci/image-tests/Fixtures/` | Files for all containers except those started with `withFiles: false`, e.g. the one for the test without `/app`: the pages in `/app`, and in `/opt/image-tests` small programs that stand in for what a test talks to: `fastcgi-request.php` sends a request straight to PHP-FPM, `smtp-sink.php` takes the mail of Postfix in place of a mail catcher, `smtp-relay.php` asks Postfix to relay, `dbgp-listener.php` takes the connections of Xdebug in place of an IDE, `capture-mail.sh` stands in for sendmail, and `nginx.conf` is a configuration for `SERVICE_NGINX_OPTS` |
| `ci/image-tests/Hooks/` | Files for the further containers, again except those with `withFiles: false`: the hooks, a command `image-test` of its own, a second virtual host for the test of `WEB_ALIAS_DOMAIN`, and an Apache configuration for the test of `SERVICE_APACHE_OPTS` |

`ci/console test:image webdevops/<image>:<tag>` runs the tests of an image; `webdevops/php-official` has the tests of `webdevops/php`. It takes the distribution and its version from `dockerTest` in `conf/console.yml`, and removes the containers of the image afterwards, also when the run is interrupted with Ctrl-C or `docker stop`.
`ci/console test:image webdevops/<image>:<tag>` runs the tests of an image; `webdevops/php-official`, a deprecated name of `webdevops/php`, has the tests of `webdevops/php`. It takes the distribution and its version from `dockerTest` in `conf/console.yml`, and removes the containers of the image afterwards, also when the run is interrupted with Ctrl-C or `docker stop`.
A runner killed with `SIGKILL` leaves its containers behind; they carry the label `webdevops.image-test`, so `docker rm --force $(docker ps --all --quiet --filter label=webdevops.image-test)` removes them.
It runs in a container of `ci/image-tests/Dockerfile`, which has PHP and the `docker` command and gets the Docker socket: `make test-image` builds that image (`make test-image-runner`) and runs the tests in it (`make test-image-run`).
The runner builds on the official PHP image, not on a webdevops image, so a broken `webdevops/php` cannot break the tests that find the defect.
Expand Down
36 changes: 36 additions & 0 deletions ci/src/Commands/GenerateGithubCiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,45 @@
}

$this->checkInternalImages($data);
$this->checkAliases($data);
return new Tree($data);
}

/**
* Every tag that "docker: aliases" in conf/console.yml publishes under a deprecated name has to be built here, and a
* deprecated name must not be built as an image of its own: docker/<name>/<tag> would publish new tags under it.
*
* @param list<array<string, mixed>> $nodes
*/
private function checkAliases(array $nodes): void
{
$built = array_column($nodes, 'id');
foreach ($this->fileReader->aliases() as $name => $alias) {
foreach ($nodes as $node) {
if ($node['image'] === $name) {
throw new RuntimeException(sprintf(

Check warning on line 195 in ci/src/Commands/GenerateGithubCiCommand.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define and throw a dedicated exception instead of using a generic one.

See more on https://sonarcloud.io/project/issues?id=webdevops_Dockerfile&issues=AaHoV2k_rF4dwmzoXtTJ&open=AaHoV2k_rF4dwmzoXtTJ&pullRequest=628
'webdevops/%1$s is a deprecated name in "docker: aliases" of conf/console.yml, but %2$s builds it as an image of its own. Build the tag in docker/%3$s instead.',
$name,
dirname((string)$node['file']),
$alias['image'],
));
}
}

foreach ($alias['tags'] as $tag) {
$image = 'webdevops/' . $alias['image'] . ':' . $tag;
if (!in_array($image, $built, true)) {
throw new RuntimeException(sprintf(

Check warning on line 207 in ci/src/Commands/GenerateGithubCiCommand.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define and throw a dedicated exception instead of using a generic one.

See more on https://sonarcloud.io/project/issues?id=webdevops_Dockerfile&issues=AaHoZLAzAsyMT0ogO3QJ&open=AaHoZLAzAsyMT0ogO3QJ&pullRequest=628
'"docker: aliases" in conf/console.yml publishes %s as webdevops/%s:%s, which is not built. Remove the tag from the list.',
$image,
$name,
$tag,
));
}
}
}
}

/**
* Every webdevops image that an image builds on (FROM) or copies from (COPY --from) has to be built here too.
* The tree would otherwise only report a node that "points to non-existent parent".
Expand Down
Loading
Loading