-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add PHP PIE for installing extensions to docs #2521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
jnoordsij
wants to merge
3
commits into
docker-library:master
Choose a base branch
from
jnoordsij:add-php-pie
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,8 +71,29 @@ See also ["Dockerizing Compiled Software"](https://tianon.xyz/post/2017/12/26/do | |
|
|
||
| Some extensions are compiled by default. This depends on the PHP version you are using. Run `php -m` in the container to get a list for your specific version. | ||
|
|
||
| ### PIE extensions | ||
|
|
||
| The latest recommended way of installing PHP extensions is through [PIE](https://github.com/php/pie). To install a PIE-compatible extension, use `pie install` to download, compile and enable it. | ||
|
|
||
| ```dockerfile | ||
| FROM %%IMAGE%%:8.2-cli | ||
|
|
||
| # Install PIE here; e.g. through using Docker | ||
| RUN export DEBIAN_FRONTEND="noninteractive"; \ | ||
| set -eux; \ | ||
| apt-get update; apt-get install -y --no-install-recommends unzip; \ | ||
| rm -rf /var/lib/apt/lists/* | ||
| COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie | ||
|
|
||
| # Use PIE to install extensions | ||
| RUN pie install phpredis/phpredis:^6.1 \ | ||
| && pie install xdebug/xdebug:^3.4 | ||
| ``` | ||
|
|
||
| ### PECL extensions | ||
|
|
||
| ⚠️ Note: Installation of PEAR and thus also PECL with PHP is deprecated and thus subject to removal in a future PHP version. See also https://github.com/php/php-src/commit/e93d6d97aab7a5de1f7b8dc750ca9d08214de8c4. | ||
|
|
||
|
Comment on lines
93
to
+96
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be okay to drop the PECL section entirely. See also: docker-library/php#1654. |
||
| Some extensions are not provided with the PHP source, but are instead available through [PECL](https://pecl.php.net/). To install a PECL extension, use `pecl install` to download and compile it, then use `docker-php-ext-enable` to enable it: | ||
|
|
||
| ```dockerfile | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer the
RUN --mountfrom docker-library/php#1554 (comment) to not unnecessarily include PIE in the final image.