Repository navigation
Improve Docker build times by compiling PHP extensions in parallel - #315
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the production Docker build changes.
No open issues 🎉
What changed in this PR
This PR speeds up the recommended production Docker build by separating dependency installation and PHP extension compilation into parallel stages, while keeping the integration Dockerfile aligned with the documentation.
Changes:
- Build
ext-evandext-socketsin separate stages using a smaller shared toolchain. - Copy compiled extensions into the runtime image without carrying over build tools or temporary files.
- Remove the external Dockerfile syntax directive from both documented examples and integration Dockerfiles.
| File | Description |
|---|---|
| tests/integration/Dockerfile-production | Mirrors the parallel extension builds and streamlined production image. |
| tests/integration/Dockerfile-basics | Removes the external syntax directive. |
| docs/best-practices/deployment.md | Documents the parallel production build and updates both Dockerfile examples. |
Review effort: Balanced
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.
This changeset improves the Docker build times for our recommended
Dockerfileby compiling the recommendedext-evandext-socketsextensions in parallel build stages instead of a single sequentialRUNstep. The build toolchain is also narrowed from twelve packages to five and named.phpize-deps, which is the namedocker-php-ext-installlooks for before installing and purging all ten$PHPIZE_DEPSitself.The workstation row is medians of five cold builds per variant, alternating between the two so host load cancels out, with base images pulled beforehand. Spreads were under half a second. The CI row is the Docker job's
docker buildstep across real runs, 10 before spanning 26-41s and 5 after spanning 15-25s.Along the way this drops the
# syntax=docker/dockerfile:1directive from bothDockerfileinstructions, as nothing in them needs the external frontend and fetching it costs a serial registry round-trip on every build.The resulting image is a strict subset of the previous one: the duplicate
libevpackage is gone, as PECL'sevbundles and static-links its own copy and never linked the system one, along with the/tmp/pearbuild leftovers the old single-stage build shipped.ext-evitself is unchanged, and theDockerfilein our integration tests keeps following the documentation as before.Builds on top of #297, #207, #156, #149, #136 and https://github.com/clue-engineering/gisthook/pull/129 (private)