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

Debian Stretch Apache 5.6 Dockerfile leaves unnecessary build-time dependencies in layer, bloating image #778

Closed
wyqydsyq opened this issue Jan 17, 2019 · 2 comments

Comments

@wyqydsyq
Copy link

wyqydsyq commented Jan 17, 2019

The Dockerfile installs a bunch of build-time dependencies, apparently for "phpize" and never removes them, this results in a 209MB layer:

<missing>           2 weeks ago         /bin/sh -c #(nop)  ENV PHP_INI_DIR=/usr/loca…   0B
<missing>           2 weeks ago         /bin/sh -c apt-get update && apt-get install…   209MB
<missing>           2 weeks ago         /bin/sh -c #(nop)  ENV PHPIZE_DEPS=autoconf …   0B

Which arguably provides little to no benefit to most users of this image, a lot of people don't use PECL extensions let alone phpize to install them and in our case, we're explicitly installing them with the PECL installer in our own image.

In the odd case someone does want to use phpize, there should be an alternative image with it enabled, instead of pointlessly bloating the base apache image.

For some reason, Docker Hub misreports the image as being 130MB:

5.6-apache 130 MB
Last update: 2 days ago

But in reality upon pulling it, you find it's actually a whopping 355MB:

php    5.6-apache          a62c5acfd6c5        2 days ago          355MB

I'm guessing a lot of this bloat is due to the completely unnecessary 209MB layer mentioned.

@wyqydsyq wyqydsyq changed the title Apache 5.6 stretch Dockerfile leaves unnecessary build dependencies in layer Apache 5.6 stretch Dockerfile leaves unnecessary build dependencies in layer, bloating image Jan 17, 2019
@wyqydsyq wyqydsyq changed the title Apache 5.6 stretch Dockerfile leaves unnecessary build dependencies in layer, bloating image Apache 5.6 stretch Dockerfile leaves unnecessary build-time dependencies in layer, bloating image Jan 17, 2019
@wyqydsyq
Copy link
Author

wyqydsyq commented Jan 17, 2019

In contrast, the Alpine-based image prevents these dependencies remaining by wrapping them all into a virtual package called .build-deps which gets deleted:

&& apk del .build-deps \

Distributions like Debian and Ubuntu using apt-get should be able to support an equivalent functionality if including phpize in the base image is absolutely necessary (it seems completely redundant to me though) via the equivs utility: https://www.unixdaemon.net/linux/creating-debian-virtual-packages/

@wyqydsyq wyqydsyq changed the title Apache 5.6 stretch Dockerfile leaves unnecessary build-time dependencies in layer, bloating image Debian Stretch Apache 5.6 Dockerfile leaves unnecessary build-time dependencies in layer, bloating image Jan 17, 2019
@yosifkit
Copy link
Member

Duplicate of #769 (see also #513 #438 #557 #751 #716)

Docker Hub reporting 130MB is the compressed size. which is the amount downloaded from the Hub, while 355MB is the on-disk extracted size.


On a side note: 5.6 is end of life (https://secure.php.net/supported-versions.php, #768) and was only added back for a security fix (#775) and will likely be removed again soon. The images will still be available to pull, but they will no longer be rebuilt if the base image get updated.

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

No branches or pull requests

2 participants