Skip to content

[FEATURE] Install file in the PHP images - #603

Merged
Kanti merged 2 commits into
webdevops:masterfrom
andersundsehr:feature/install-file
Nov 10, 2026
Merged

Kanti merged 2 commits into
webdevops:masterfrom
andersundsehr:feature/install-file

Conversation

@Kanti

@Kanti Kanti commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

The PHP images (php, php-apache, php-nginx and their -dev images) get the command file, which tells the type of a file; tools such as GrumPHP's BOM check call it. The Alpine images had none; in the Debian images it came with $PHPIZE_DEPS of the official image and is now installed explicitly. A serverspec test checks it in every PHP image, and AGENTS.md asks for such a test whenever a package is added.

Size

Only the 24 Alpine PHP images grow; the Debian images already had file.

  • Download (compressed, amd64): +0.59 MB per image, +0.32 % on average (0.29–0.36 %)
  • On disk: +10.9 MB per image, almost all of it magic.mgc; +1.7 % for php:8.x-alpine
  • All 48 PHP images: +0.29 MB and +0.16 % on average

Changes

  • template/Dockerfile/images/php.jinja2: file in official() and officialAlpine(); docker/php-official/*/Dockerfile regenerated with make provision
  • tests/serverspec: misc::file runs file and checks that it tells a PHP script from a binary; collection::php includes it
  • AGENTS.md: new section "Packages come with tests"
  • docs/customization.md: file in "Tools for your Dockerfile"

How it was verified

  • make provision, ci/console github:generate-ci and readme-banner:generate: only the eight php-official Dockerfiles change
  • misc::file with serverspec.sh: passes on php:8.5, fails on the published php:8.5-alpine without file, passes with file installed
  • The build of php-official/8.5-alpine installs file 5.47; file --mime-type works in the Alpine and Debian images

The PHP images get the command file, which tells the type of a file. Tools such as GrumPHP's BOM check call it; the Alpine images had none. In the Debian images it came with $PHPIZE_DEPS of the official image and is now installed explicitly.
misc::file checks in every PHP image that file runs and tells a PHP script from a binary. AGENTS.md asks for such a test, and for the size increase in the pull request description, whenever a package is added.
@sonarqubecloud

Copy link
Copy Markdown

@Kanti
Kanti merged commit 9c63572 into webdevops:master Nov 10, 2026
178 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant