Fix: Bump Docker base image to PHP 8.4 to match the required PHP version - #1403
Merged
Merged
Conversation
8.3 (upstream's pin): build fails at composer dump-autoload → Composer ... require a PHP version ">= 8.4.1".
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.
Summary
The repository declares PHP 8.4 as its requirement but the Dockerfile still pins the image to
php:8.3-fpm-alpine. This mismatch breaks the Docker build. This PR bumps the base image tophp:8.4-fpm-alpineto match the actual requirement.Reasoning
composer.jsonrequires"php": "^8.4"README.mdstates "PHP 8.4+" (requirements:PHP 8.4+, Composer, Node 20+, PostgreSQL 16+)FROM php:8.3-fpm-alpine(line 1), which is too oldWith the current 8.3 base, the build proceeds through
composer installbut then fails duringcomposer dump-autoload, because Composer'splatform_check.phpenforces the version fromcomposer.json.Errors found during testing
PHP 8.3 (current base) — build fails
Occurs at the
composer dump-autoload --optimize && npm install && npm run buildstep (theIlluminate\Foundation\ComposerScripts::postAutoloadDumphandler triggers the platform check).PHP 8.5 — build fails (not a drop-in fix)
At
php:8.5-fpm-alpinethe extension list does not compile cleanly (themodules/directory ends up empty), so this step fails before Composer even runs.PHP 8.4 — build succeeds
docker-php-ext-install pdo pdo_pgsql mbstring exif pcntl bcmath gd opcache intl zipcompletes with exit code 0 onphp:8.4-fpm-alpine.composer.json^8.4and README "PHP 8.4+".Notes
php:8.4is the minimal correct target: it satisfies the declared^8.4constraint and the published README requirement, and all required PHP extensions build successfully.php:8.5(referenced in the project description) is not a clean swap — it additionally requires fixing the extension build.Proof of concept
Screenshot attached: Ansible applying this exact one-line Dockerfile change and the role completing successfully (image built, containers healthy) — confirming the 8.4 bump is sufficient on its own for a clean build and run.
Additional changes needed behind a reverse proxy (not part of this diff)
The PHP bump is necessary but not the only thing required to get the app rendering correctly behind a TLS-terminating reverse proxy (Traefik in my case). These are deployment-side and intentionally excluded from this PR, but worth flagging:
http://asset/route URLs and the browser blocked the JS/CSS, leaving the page unstyled.docker/start.shrunsphp artisan config:cache, and the framework's defaultTrustProxiesmiddleware readsconfig('trustedproxy.proxies')(TrustProxies.php:69). Adding a smallconfig/trustedproxy.phpreturning['proxies' => env('TRUSTED_PROXIES', '*')]withTRUSTED_PROXIES=*makes the app honorX-Forwarded-Proto/X-Forwarded-Host.Modules/{Admin,Demo,Location,Report,Review,Theme}/resources/viewsdirectories, which abortsphp artisan view:cacheat startup.vite.config.tssetscssCodeSplit: false; the theme CSS is emitted as a separatestyle.cssasset that@vite(['resources/ts/app.ts'])never links, so/and/panelrender unstyled even once the proxy is handled.Context
This was found while creating an Ansible role to deploy OpenClassify for one of my projects. The build issues above were triaged and tested with AI assistance (
php:8.3,php:8.4, andphp:8.5base images were each built and the failures recorded), as were the reverse-proxy/startup fixes above.Division of labor: the code change in this PR is a single number typed by hand —
8.3→8.4✏️ (that's the whole diff, I promise). The PR write-up, plus the triage/diagnosis of the build failures and the fixes to get the app working behind a reverse proxy in my deployment, were done with AI assistance.