Repository navigation
[!!!][TASK] Generate the Dockerfiles and conf/ in PHP with Twig and remove the Python generator - #604
Merged
Conversation
Only renames without any change of content, so that Git keeps the history of every file: - template/**/*.jinja2 and docker/<image>/<tag>/Dockerfile.jinja2 become .twig, also the template of the test repository. - GithubCommand and ReadmeBannerCommand and their tests become GenerateGithubCiCommand and GenerateReadmeBannerCommand. The next commit changes their content. Until then neither make provision nor ci/console works.
…emove the Python generator
make generate runs composer install and ci/console generate in
webdevops/php:8.4-alpine as the calling user, and ci/console generate
writes every generated file in PHP:
- generate:dockerfile renders docker/<image>/<tag>/Dockerfile with Twig
(strict_variables). template/Dockerfile/layout.twig writes the header
and includes the Dockerfile.twig of the tag. A tag directory with
files but no Dockerfile.twig is an error: nothing would update it,
but generate:github-ci would still build and publish its Dockerfile.
It keeps the links docker/php/<tag> to docker/php-official/<tag> and
first removes the .DS_Store files of the macOS Finder under docker/.
- generate:provision copies provisioning/ into conf/ as
conf/provision.yml says, like bin/console did: it empties the conf/
directories of an image first, copies the sources in the order of the
file and keeps the file permissions. It checks the whole file first
and stops if a source or a tag does not exist, or if an image has
another setting than "configuration". A tag pattern has to match the
whole tag now; no tag in the repository is affected.
- github:generate-ci and readme-banner:generate are renamed to
generate:github-ci and generate:readme-banner. generate:github-ci
names the directory to remove when an image builds on or copies from
a webdevops image that is not built any more.
- TagDirectories is the one list of tags (directories with a
Dockerfile.twig, without the links docker/php/<version>) for both
generators and FileReader.
The templates are Twig templates:
- A Dockerfile.twig imports the macros it uses from
template/Dockerfile/, e.g. {% import 'docker.twig' as docker %}. A
macro imports the macros it calls in its own body, because Twig
macros do not see the imports of their file.
- Tags alone on a line need no "-", because Twig removes the line break
after a tag by itself; elif becomes elseif; baselayout.copy(), whose
output starts with a line break, gets an empty first line.
- externalExtensions() moves from php.twig to images/php-extensions.twig
as external(), because Twig only calls a macro of the same file after
importing it.
- The comment "Check if needed" in the four Alpine php-official
templates moves above phpOfficialSendmailWorkaround(). The trailing
space after ENV PHP_SENDMAIL_PATH in php-official 8.2- to 8.5-alpine
disappears, the only change in the Dockerfiles.
make check installs the PHP tools of ci/ and runs GrumPHP as the
calling user, make test only the PHPUnit tests. The CI runs
make generate and fails on a changed or a new file, and it runs
make check.
Removed: bin/ (the Python 2 generator), the Makefile targets provision,
requirements, list and setup, tests/serverspec/__init__.py,
tests/structure-test/install.sh, the settings in conf/console.yml that
only bin/ read, and in webdevops/dockerfile-build-env Python 2, pip and
the clone of the repository whose gems docker-image-cleanup deleted
again. README, AGENTS.md and docs/ describe make generate, make check
and the templates.
|
This was referenced Nov 11, 2026
Closed
Kanti
marked this pull request as ready for review
November 11, 2026 06:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Caution
Merge with "Rebase and merge", not "Squash and merge"
The first commit only renames files, the second changes them. A squash would lose the history of
template/Dockerfile/layout.twig: only 4 of its 22 lines stay the same, too few for Git to see the rename.Summary
make generatewrites every generated file in PHP: the Dockerfiles from Twig templates, theirconf/fromprovisioning/,.github/workflows/build.yamland the README banner. It runscomposer installandci/console generateinwebdevops/php:8.4-alpineas the calling user, so onlymakeand Docker are needed. The Python 2 generator behindmake provision(bin/) is removed, and so is Python 2 inwebdevops/dockerfile-build-env. The images stay the same apart from one trailing space in four Dockerfiles.[!!!]becausemake provisionno longer exists for contributors and the templates are Twig templates now.Changes
generate:dockerfilerenders the Dockerfiles with Twig and keeps the linksdocker/php/<tag>.generate:provisioncopiesprovisioning/intoconf/asconf/provision.ymlsays and checks the whole file first.generateruns all four generators.github:generate-ciandreadme-banner:generatebecomegenerate:github-ciandgenerate:readme-banner.make generate,make check(GrumPHP) andmake test(PHPUnit) run as the calling user. The CI runsmake generateandmake check.bin/, the Makefile targetsprovision,requirements,listandsetup, Python 2 indockerfile-build-env.docs/updated.Closes #549. Replaces the pull requests #451 and #548, which move the generator to Python 3: here it is rewritten in PHP.
All changes and how each was verified: andersundsehr#16