Skip to content
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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jnoordsij
Copy link

@jnoordsij jnoordsij commented Jan 2, 2025

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

  • Decide on whether or not to suggest an explicit way of installing PIE in the example, or just leave the reference to the docs as I did now
    • In particular the core extension zip is required, so installation is not entirely trivial
  • Check whether adding the deprecation notice for PECL is not a bit too eager
  • Pending what happens with Cleanup on aisle vendor php/pie#157, adding something like rm -rf ~/.composer ~/.pie to the suggested installation steps might be relevant to reduce the size of the built image

@jnoordsij
Copy link
Author

@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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably do:

Suggested change
# 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...

Copy link

@asgrim asgrim Jan 2, 2025

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)

Copy link
Author

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.

Copy link
Contributor

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)

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.

3 participants