Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
733 changes: 4 additions & 729 deletions .github/workflows/build.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,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 and tags that are no longer built (`nginx`, `apache`, the `alpine` tags of `bootstrap`, `base` and `base-app`, `storage`, `vsftp`, `ssh`) or deprecated (`php-official`) |
| `docs/discontinued-images.md` | Replacements for images and tags that are no longer built (`bootstrap`, `base`, `base-app`, `dockerfile-build-env`, `nginx`, `apache`, `storage`, `vsftp`, `ssh`) or deprecated (`php-official`) |
| `docs/dockerhub/*.md` | The pages on Docker Hub: a start page per built image with its tags and links into `docs/`, a warning per image that is no longer built. Generated from `conf/dockerhub.yml`; change the texts there |

### When to update it
Expand Down Expand Up @@ -102,7 +102,7 @@ Update the documentation whenever a change touches any of these:

Where you can, make the check an image test, so that the CI repeats it: a variable goes into `ENVIRONMENT` in `ci/image-tests/ImageTestCase.php`, the check of its effect into a trait in `ci/image-tests/Checks/`.

Check every image a statement names, not just one representative: images differ in what they inherit (for example `cli` runs `CLI_SCRIPT` as `application` in `base-app` and `php-*`, but as `root` in `base`, which has no user `application`). Check both the Debian and the Alpine variant whenever their implementation differs (separate files under `provisioning/*/alpine`, apk vs. apt, `httpd` vs. `apache2`, `crond` vs. `cron`). Test examples with the exact command you document, and make sure a check cannot pass on an error message.
Check every image a statement names, not just one representative: images differ in what they inherit (for example Postfix and the SSH server run only in the `-dev` images). Check both the Debian and the Alpine variant whenever their implementation differs (separate files under `provisioning/*/alpine`, apk vs. apt, `httpd` vs. `apache2`, `crond` vs. `cron`). Test examples with the exact command you document, and make sure a check cannot pass on an error message.

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` used to be passed to `postfix` after `start`, which ignored it. When you fix a known issue, remove its entry in the same pull request.

Expand Down
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Edit the `Dockerfile.twig` templates, the shared templates in `template`, the fi
`template/Dockerfile/layout.twig` writes the header of every Dockerfile and includes its `Dockerfile.twig`.
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 itself.
`generate:provision` empties the `conf/` directories of an image first, so a file removed from `provisioning` disappears there too.
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`.
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 images are built on Debian and Alpine, and the scripts also serve your own images on Ubuntu, see [Replacing discontinued images](docs/discontinued-images.md#webdevopsbootstrap-webdevopsbase-and-webdevopsbase-app). `generate:provision` copies them into `docker/toolbox/latest/conf/`, `toolbox` keeps them under `/baselayout`, 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.
Expand Down Expand Up @@ -58,7 +58,9 @@ It does not update the actions in `.github/workflows/build.yaml`, because that f
A new push to a pull request cancels the run of its previous commit. Runs on `master`, the nightly run and runs started by hand are never cancelled.

GitHub Actions builds every image independently and runs the image tests
defined for it before pushing it to Docker Hub. The CI also uses `ghcr.io/webdevops/`, but only
defined for it before pushing it to Docker Hub. The jobs run directly on the GitHub-hosted runners, `ubuntu-24.04` for
`linux/amd64` and `ubuntu-24.04-arm` for `linux/arm64`, which have Docker, Buildx, git and make; they need no
container of their own. The CI also uses `ghcr.io/webdevops/`, but only
internally; pull the images from Docker Hub.

The job "Update the Docker Hub pages" uploads `docs/dockerhub/<repository>.md` and the short description of each repository to Docker Hub when `build.yaml` runs on `master` after a push or is started by hand. It does not run for pull requests, in the nightly run, in the builds that `php-upstream.yaml` starts (a failed upload would keep it from starting the next one) or in forks, and no other job waits for it.
Expand Down
13 changes: 5 additions & 8 deletions ci/image-tests/Checks/AdditionalServicesChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
use PHPUnit\Framework\Attributes\DataProvider;
use Webdevops\Build\ImageTests\ImageTestCase;

use function array_diff;
use function array_values;

/**
* docker-service installs, enables and starts the services that webdevops/base does not run by default. It does so in a
* docker-service installs, enables and starts the services that the image does not run by default. It does so in a
* container of its own, so that the container of the class keeps the services of the image.
*
* @phpstan-require-extends ImageTestCase
Expand All @@ -20,13 +23,7 @@ trait AdditionalServicesChecks
*/
public static function additionalServices(): array
{
return self::cases([
'cron',
'dnsmasq',
'postfix',
'ssh',
'syslog',
]);
return self::cases(array_values(array_diff(['cron', 'dnsmasq', 'postfix', 'ssh', 'syslog'], self::services())));
}

#[DataProvider('additionalServices')]
Expand Down
3 changes: 2 additions & 1 deletion ci/image-tests/Checks/BaseAppChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
use function trim;

/**
* Checks of the images based on webdevops/base-app: the application user, locales and moreutils.
* Checks of the base-app layer of the images (template/Dockerfile/images/baseapp.twig and provisioning/base-app): the
* application user, locales and moreutils.
*
* @phpstan-require-extends ImageTestCase
*/
Expand Down
7 changes: 4 additions & 3 deletions ci/image-tests/Checks/BaseChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use function trim;

/**
* Checks of the images based on webdevops/base: the layout under /opt/docker, supervisor and the tools.
* Checks of the base layer of the images (template/Dockerfile/images/base.twig and provisioning/base): the layout
* under /opt/docker, supervisor and the tools.
*
* @phpstan-require-extends ImageTestCase
*/
Expand Down Expand Up @@ -162,7 +163,7 @@ public function testDockerCronjobAddsAJobThatCronRunsAsItsUser(): void
}

/**
* The commands of webdevops/base, where the distribution has them: netstat and sed are in /bin in Alpine.
* The commands of the base layer, where the distribution has them: netstat and sed are in /bin in Alpine.
*
* @return iterable<string, array{string, string}>
*/
Expand All @@ -188,7 +189,7 @@ public function testBaseCommandIsOnThePath(string $command, string $path): void
}

/**
* The scripts and the configuration of webdevops/base have exactly the modes 0755 and 0644: no setuid, setgid or
* The scripts and the configuration of the base layer have exactly the modes 0755 and 0644: no setuid, setgid or
* sticky bit.
*
* @return iterable<string, array{string, string}>
Expand Down
10 changes: 5 additions & 5 deletions ci/image-tests/Checks/BootstrapChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
use function sprintf;

/**
* Checks of every image: the layout and tools of webdevops/bootstrap and the distribution.
* Checks of every image: the layout and the tools of the bootstrap layer (template/Dockerfile/images/bootstrap.twig and
* provisioning/baselayout) and the distribution.
*
* @phpstan-require-extends ImageTestCase
*/
Expand Down Expand Up @@ -146,8 +147,7 @@ public function testApkInstallsFromTheCache(): void
}

/**
* The variables of the locale and the terminal that webdevops/bootstrap and the PHP images set, and the PATH of the
* distribution and of the official PHP image.
* The variables of the locale and the terminal that the images set, and the PATH of the official PHP image.
*/
public function testLocaleTerminalAndPathOfTheImage(): void
{
Expand Down Expand Up @@ -195,8 +195,8 @@ public function testBootstrapCommandPermissions(string $path): void

/**
* gosu, with which the entrypoint runs commands as another user, is a program of root with the mode 0755 in the
* running container. webdevops/base and the PHP images build it with the setuid and setgid bits, so that their
* entrypoint can switch to root when the container starts as another user, and the entrypoint removes them.
* running container. The images build it with the setuid and setgid bits, so that their entrypoint can switch to
* root when the container starts as another user, and the entrypoint removes them.
*/
public function testGosuPermissions(): void
{
Expand Down
40 changes: 0 additions & 40 deletions ci/image-tests/Checks/BuildEnvChecks.php

This file was deleted.

25 changes: 0 additions & 25 deletions ci/image-tests/Checks/CliWithoutApplicationUserChecks.php

This file was deleted.

2 changes: 1 addition & 1 deletion ci/image-tests/Checks/HealthcheckChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testHealthcheckIgnoresAStoppedService(): void

/**
* From PHP 8.6 on, the PHP images run docker-healthcheck as their HEALTHCHECK and Docker reports them as healthy;
* the older PHP images and the base images have no HEALTHCHECK.
* the older PHP images have no HEALTHCHECK.
*/
public function testHealthcheckOfTheImage(): void
{
Expand Down
8 changes: 4 additions & 4 deletions ci/image-tests/Checks/ServiceChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ trait ServiceChecks
];

/**
* The services of webdevops/base that docker-service enable installs, see docs/customization.md#services.
* The services that docker-service enable installs, see docs/customization.md#services.
*/
private const array INSTALLABLE_SERVICES = ['cron', 'dnsmasq', 'postfix', 'ssh', 'syslog'];

Expand Down Expand Up @@ -165,7 +165,7 @@ private function runningServices(?Container $container = null): array
}

/**
* The services of the image and the services of webdevops/base, each with its configuration in
* The services of the image and the services that docker-service enable installs, each with its configuration in
* /opt/docker/etc/supervisor.d.
*
* @return iterable<string, array{string}>
Expand All @@ -178,8 +178,8 @@ public static function supervisorPrograms(): iterable
}

/**
* supervisord starts the services of the image by itself (autostart = true), the other services of webdevops/base
* only once docker-service enable sets it.
* supervisord starts the services of the image by itself (autostart = true), the other services only once
* docker-service enable sets it.
*/
#[DataProvider('supervisorPrograms')]
public function testServiceStartsAutomaticallyOnlyIfTheImageRunsIt(string $service): void
Expand Down
6 changes: 3 additions & 3 deletions ci/image-tests/Docker/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ private function __construct(public string $id)
/**
* Creates a container of $image, copies the files under each of $directories into its root directory and starts
* it. Only files are copied: directories of the image keep their owner and mode, see FileArchive. stdin stays
* open, so that an image whose command is a shell, such as webdevops/bootstrap, keeps running. $labels are added
* to the container, e.g. to find and remove it later.
* open, so that an image whose command is a shell keeps running. $labels are added to the container, e.g. to find
* and remove it later.
*
* Returns once the entrypoint of the image has run its scripts, which write the configuration from the
* environment, and has replaced itself with the command, e.g. supervisord.
Expand Down Expand Up @@ -150,7 +150,7 @@ public function exec(string $command): CommandResult

/**
* Waits while process 1 is still the entrypoint, /opt/docker/bin/entrypoint.sh started as /entrypoint. Images
* without it, such as webdevops/bootstrap, are ready at once.
* without it are ready at once.
*/
private function waitForEntrypoint(): void
{
Expand Down
4 changes: 2 additions & 2 deletions ci/image-tests/ImageUnderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public function isThreadSafe(): bool
}

/**
* The PHP images run docker-healthcheck as their HEALTHCHECK from PHP 8.6 on; the older ones and the base images
* only offer the command.
* The PHP images run docker-healthcheck as their HEALTHCHECK from PHP 8.6 on; the older ones only offer the
* command.
*/
public function hasHealthcheck(): bool
{
Expand Down
26 changes: 0 additions & 26 deletions ci/image-tests/Images/BaseAppTest.php

This file was deleted.

32 changes: 0 additions & 32 deletions ci/image-tests/Images/BaseTest.php

This file was deleted.

16 changes: 0 additions & 16 deletions ci/image-tests/Images/BootstrapTest.php

This file was deleted.

20 changes: 0 additions & 20 deletions ci/image-tests/Images/DockerfileBuildEnvTest.php

This file was deleted.

4 changes: 4 additions & 0 deletions ci/image-tests/Images/PhpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

namespace Webdevops\Build\ImageTests\Images;

use Webdevops\Build\ImageTests\Checks\AdditionalServicesChecks;
use Webdevops\Build\ImageTests\Checks\BaseAppChecks;
use Webdevops\Build\ImageTests\Checks\BaseChecks;
use Webdevops\Build\ImageTests\Checks\BootstrapChecks;
use Webdevops\Build\ImageTests\Checks\ContainerEnvironmentChecks;
use Webdevops\Build\ImageTests\Checks\DnsmasqEnvironmentChecks;
use Webdevops\Build\ImageTests\Checks\EntrypointChecks;
use Webdevops\Build\ImageTests\Checks\HealthcheckChecks;
use Webdevops\Build\ImageTests\Checks\PhpEnvironmentChecks;
Expand Down Expand Up @@ -35,6 +37,8 @@ final class PhpTest extends ImageTestCase
use ContainerEnvironmentChecks;
use PhpEnvironmentChecks;
use PhpFpmEnvironmentChecks;
use AdditionalServicesChecks;
use DnsmasqEnvironmentChecks;

protected const array SERVICES = ['cron', 'php-fpm', 'syslog'];
}
Loading