-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add PHP PIE for installing extensions to docs #2521
base: master
Are you sure you want to change the base?
Conversation
@asgrim (mentioning you as you've been helping out with php/pie#151): I've created this as a way to (hopefully) notify (new) Docker image users of PIE. However this is just a first stab from my side and would very much like some upstream feedback if you can provide any (or know of someone who can). In particular regarding the stability/status I'm wondering if putting this in right now or at some later moment is more suitable, when it is more stabilized. |
```dockerfile | ||
FROM %%IMAGE%%:8.2-cli | ||
|
||
# Install PIE here (see https://github.com/php/pie/blob/main/docs/usage.md) |
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.
This could probably do:
# Install PIE here (see https://github.com/php/pie/blob/main/docs/usage.md) | |
# Install PIE here (see https://github.com/php/pie/blob/main/docs/usage.md) | |
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie |
perhaps? to demo a real working example...
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.
This is a working example:
FROM php:8.4-cli
RUN apt-get update \
&& apt-get install -y libzip-dev zip \
&& docker-php-ext-install zip
COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
RUN pie install xdebug/xdebug
Ironically, you can't use PIE to install the zip
extension as it depends on it (see php/pie#168)
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.
Thanks a lot for looking into this so quickly! I too do prefer the COPY --from=ghcr.io/php/pie:bin
call for installing this. Given that multi-stage builds are officially supported nowadays this probably should be fine. Given that is an example and official upstream source referencing a non-official image is probably also fine, but I'll wait for maintainer feedback on that.
I also just figured the zip
extension requirement makes it somewhat cumbersome to use when paired with Docker compared to PECL working out of the box. But to solve that it seems that php/pie#133 probably would also need to be addressed.
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.
This is a working example:
The zip
binary package is not required there. It should also clean up after itself. I previously provided a full example following the best practices in: php/pie#122 (comment)
Based on the discussion in docker-library/php#1554, PHP PIE is not likely to be included as part of the official PHP image. However, as it aims to replace PECL as the official way for installing PHP extensions, consumers of the PHP image should probably be informed on using this tool.
To Do/Discuss
zip
is required, so installation is not entirely trivialvendor
php/pie#157, adding something likerm -rf ~/.composer ~/.pie
to the suggested installation steps might be relevant to reduce the size of the built image