-
Notifications
You must be signed in to change notification settings - Fork 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
Remove phpize deps from permanent image #769
Comments
|
Debian does support virtual packages via the equivs utility and so these build-time dependencies should be easily manageable. This has a disadvantage vs APK in that the virtual packages need to either be pre-baked Alternatively, the dependencies could just be explicitly removed after they are used. It's a bit messier but at least prevents bloat I still don't see any good reasoning for why this support for phpize should even be included by default, it should be in a script or alternative image |
I have yet to see a user of this image who didn't need at least one Our current variant/tag list is already way out of control, so justification for a new variant is going to need to be very strong. |
My current solution is to use multi-stage with a builder to add all dependencies and then copy everything (.so and bins etc) I need into the final image: |
@estahn Would you be able to share your Dockerfile for your multi-stage build? I am in the same boat where I would like to trim the size of the |
I think that's an accurate and fair statement, which would also apply to the Alpine images. It doesn't preclude there being a better pattern for handling the build time dependencies - either a multi-stage build that does have the I'll try to work out a proof of concept this week. |
Alpine was given special treatment here specifically due to the
speed/efficiency of the `apk` package manager (especially thanks to having
an explicit `--virtual` flag to allow us to cleanly and correctly uninstall
only the things we caused to be installed). The same cannot be said of APT
(installing a package there is much more heavyweight, and it then becomes
more difficult to track which packages *we* caused to be installed versus
packages that were already installed).
|
Here is a multi-stage example for generating a compact image, image size has been reduced from 431MB to 155MB.
|
I'm having the same problem, currently working on that to make a script to clean up build deps and things that are not used on final image |
@axot |
Just wondering why we require perl in image
php:7.1-fpm-stretch
?/usr/lib/x86_64-linux-gnu/perl => 19MB
It appears to be related to phpize. Is there a need for it to be permanent in the image or could this be moved to a
docker-php-
script?It's not relevant in production environments imo.
The text was updated successfully, but these errors were encountered: