Uh oh!
There was an error while loading. Please reload this page.
Reduced the size of the image by about %23 - #96
Conversation
md5
commented
May 7, 2015
I was going to ask whether this breaks the LGTM |
thaJeztah
commented
May 7, 2015
Nice idea! LGTM |
yosifkit
commented
May 11, 2015
Hmmm... it looks like a good idea, but I see a problem. After running FROM php:apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
&& docker-php-ext-install iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd
# this RUN would end with a new tar of /usr/src/php (with the configure options zipped in)# now the image takes the space of two bzipped php source tars |
tianon
commented
May 14, 2015
|
md5
commented
May 14, 2015
It seems like just removing the FROM php:apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install iconv mcrypt gdThat way the unbzipping would only happen once in On that last point, something like this would be pretty pathological: FROM php:apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev
RUN docker-php-ext-configure iconv
RUN docker-php-ext-install iconv
RUN docker-php-ext-configure mcrypt
RUN docker-php-ext-install mcrypt
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gdI think you'd end up with three copies of |
It bzips the /usr/src/php to reduce the size of the image. bzip2 package is moved outside of the $buildDeps just for backwards compatibility otherwise one would have needed to add bzip2 into their Dockerfile as build dependency.
yosifkit
commented
May 14, 2015
Well, it seems we have at least 13 users that would be affected (github search). There are around 100-400 that use the install and configure scripts. |
39386fe to
82a7d91Comparearmen
commented
May 15, 2015
@md5 I've removed tar step and I think it'll work @yosifkit But I can't see how they would be affected? If you mean this: Since the /usr/src/php is deleted at the end of docker-php-ext-install it still will work |
yosifkit
commented
May 15, 2015
Yes, |
armen
commented
May 16, 2015
@yosifkit I see, that makes sense, I thought you mean the change wouldn't be backwards compatible for those users. |
armen
commented
May 16, 2015
@yosifkit On the second thought now I understand what you mean by affected users, they might end up with bigger image with this patch, is that correct? |
md5
commented
May 16, 2015
shouze
commented
Jul 7, 2016
shouze
commented
Jul 14, 2016
armen
commented
Jul 14, 2016
Fantastic, thanks @shouze great job |
It bzips the /usr/src/php to reduce the size of the image. bzip2
package is moved outsize of the $buildDeps just for backwards
compatibility otherwise one would have needed to add bzip2 into
their Dockerfile as build dependency.