Skip to content

Commit

Permalink
alpine workaround for iconv
Browse files Browse the repository at this point in the history
  • Loading branch information
htuscher committed Apr 13, 2020
1 parent 20cb068 commit 87b70d2
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docker/php-official/7.1-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ENV APPLICATION_USER=application \
APPLICATION_UID=1000 \
APPLICATION_GID=1000
ENV PHP_SENDMAIL_PATH="/usr/sbin/sendmail -t -i"
ENV LD_PRELOAD="/usr/local/lib/preloadable_libiconv.so"


# Baselayout copy (from staged image)
Expand Down Expand Up @@ -128,6 +129,7 @@ RUN set -x \
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down Expand Up @@ -155,6 +157,17 @@ RUN set -x \
&& make -C guetzli-master \
&& cp guetzli-master/bin/Release/guetzli /usr/local/bin/ \
&& rm -rf master.zip guetzli-master \
# https://github.com/docker-library/php/issues/240
&& rm /usr/bin/iconv \
&& curl -SL http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz | tar -xz -C . \
&& cd libiconv-1.14 \
&& ./configure --prefix=/usr/local \
&& curl -SL https://raw.githubusercontent.com/mxe/mxe/7e231efd245996b886b501dad780761205ecf376/src/libiconv-1-fixes.patch | patch -p1 -u \
&& make \
&& make install \
&& libtool --finish /usr/local/lib \
&& cd .. \
&& rm -rf libiconv-1.14
# Install extensions
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/ \
&& docker-php-ext-configure ldap \
Expand Down Expand Up @@ -211,6 +224,7 @@ RUN set -x \
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down
1 change: 1 addition & 0 deletions docker/php-official/7.1-alpine/Dockerfile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{{ environment.base() }}
{{ environment.baseApp() }}
{{ environment.phpOfficialSendmailWorkaround() }} {# Check if needed #}
{{ environment.phpAlpineIconvWorkaround() }}

{{ baselayout.copy() }}

Expand Down
14 changes: 14 additions & 0 deletions docker/php-official/7.2-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ENV APPLICATION_USER=application \
APPLICATION_UID=1000 \
APPLICATION_GID=1000
ENV PHP_SENDMAIL_PATH="/usr/sbin/sendmail -t -i"
ENV LD_PRELOAD="/usr/local/lib/preloadable_libiconv.so"


# Baselayout copy (from staged image)
Expand Down Expand Up @@ -128,6 +129,7 @@ RUN set -x \
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down Expand Up @@ -155,6 +157,17 @@ RUN set -x \
&& make -C guetzli-master \
&& cp guetzli-master/bin/Release/guetzli /usr/local/bin/ \
&& rm -rf master.zip guetzli-master \
# https://github.com/docker-library/php/issues/240
&& rm /usr/bin/iconv \
&& curl -SL http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz | tar -xz -C . \
&& cd libiconv-1.14 \
&& ./configure --prefix=/usr/local \
&& curl -SL https://raw.githubusercontent.com/mxe/mxe/7e231efd245996b886b501dad780761205ecf376/src/libiconv-1-fixes.patch | patch -p1 -u \
&& make \
&& make install \
&& libtool --finish /usr/local/lib \
&& cd .. \
&& rm -rf libiconv-1.14
# Install extensions
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/ \
&& docker-php-ext-configure ldap \
Expand Down Expand Up @@ -215,6 +228,7 @@ RUN set -x \
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down
1 change: 1 addition & 0 deletions docker/php-official/7.2-alpine/Dockerfile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{{ environment.base() }}
{{ environment.baseApp() }}
{{ environment.phpOfficialSendmailWorkaround() }} {# Check if needed #}
{{ environment.phpAlpineIconvWorkaround() }}

{{ baselayout.copy() }}

Expand Down
14 changes: 14 additions & 0 deletions docker/php-official/7.3-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ENV APPLICATION_USER=application \
APPLICATION_UID=1000 \
APPLICATION_GID=1000
ENV PHP_SENDMAIL_PATH="/usr/sbin/sendmail -t -i"
ENV LD_PRELOAD="/usr/local/lib/preloadable_libiconv.so"


# Baselayout copy (from staged image)
Expand Down Expand Up @@ -128,6 +129,7 @@ RUN set -x \
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down Expand Up @@ -155,6 +157,17 @@ RUN set -x \
&& make -C guetzli-master \
&& cp guetzli-master/bin/Release/guetzli /usr/local/bin/ \
&& rm -rf master.zip guetzli-master \
# https://github.com/docker-library/php/issues/240
&& rm /usr/bin/iconv \
&& curl -SL http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz | tar -xz -C . \
&& cd libiconv-1.14 \
&& ./configure --prefix=/usr/local \
&& curl -SL https://raw.githubusercontent.com/mxe/mxe/7e231efd245996b886b501dad780761205ecf376/src/libiconv-1-fixes.patch | patch -p1 -u \
&& make \
&& make install \
&& libtool --finish /usr/local/lib \
&& cd .. \
&& rm -rf libiconv-1.14
# Install extensions
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/ \
&& docker-php-ext-configure ldap \
Expand Down Expand Up @@ -215,6 +228,7 @@ RUN set -x \
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down
1 change: 1 addition & 0 deletions docker/php-official/7.3-alpine/Dockerfile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{{ environment.base() }}
{{ environment.baseApp() }}
{{ environment.phpOfficialSendmailWorkaround() }} {# Check if needed #}
{{ environment.phpAlpineIconvWorkaround() }}

{{ baselayout.copy() }}

Expand Down
14 changes: 14 additions & 0 deletions docker/php-official/7.4-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ENV APPLICATION_USER=application \
APPLICATION_UID=1000 \
APPLICATION_GID=1000
ENV PHP_SENDMAIL_PATH="/usr/sbin/sendmail -t -i"
ENV LD_PRELOAD="/usr/local/lib/preloadable_libiconv.so"


# Baselayout copy (from staged image)
Expand Down Expand Up @@ -128,6 +129,7 @@ RUN set -x \
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down Expand Up @@ -155,6 +157,17 @@ RUN set -x \
&& make -C guetzli-master \
&& cp guetzli-master/bin/Release/guetzli /usr/local/bin/ \
&& rm -rf master.zip guetzli-master \
# https://github.com/docker-library/php/issues/240
&& rm /usr/bin/iconv \
&& curl -SL http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz | tar -xz -C . \
&& cd libiconv-1.14 \
&& ./configure --prefix=/usr/local \
&& curl -SL https://raw.githubusercontent.com/mxe/mxe/7e231efd245996b886b501dad780761205ecf376/src/libiconv-1-fixes.patch | patch -p1 -u \
&& make \
&& make install \
&& libtool --finish /usr/local/lib \
&& cd .. \
&& rm -rf libiconv-1.14
# Install extensions
&& docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp \
&& docker-php-ext-configure ldap \
Expand Down Expand Up @@ -215,6 +228,7 @@ RUN set -x \
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down
1 change: 1 addition & 0 deletions docker/php-official/7.4-alpine/Dockerfile.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{{ environment.base() }}
{{ environment.baseApp() }}
{{ environment.phpOfficialSendmailWorkaround() }} {# Check if needed #}
{{ environment.phpAlpineIconvWorkaround() }}

{{ baselayout.copy() }}

Expand Down
4 changes: 4 additions & 0 deletions template/Dockerfile/environment.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ ENV WEB_PHP_SOCKET=127.0.0.1:9000
ENV PHP_SENDMAIL_PATH="/usr/sbin/sendmail -t -i"
{%- endmacro %}

{% macro phpAlpineIconvWorkaround() -%}
ENV LD_PRELOAD="/usr/local/lib/preloadable_libiconv.so"
{%- endmacro %}


{% macro webDevelopment() -%}
ENV WEB_NO_CACHE_PATTERN="\.(css|js|gif|png|jpg|svg|json|xml)$"
Expand Down
13 changes: 13 additions & 0 deletions template/Dockerfile/images/php.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down Expand Up @@ -212,6 +213,17 @@
&& make -C guetzli-master \
&& cp guetzli-master/bin/Release/guetzli /usr/local/bin/ \
&& rm -rf master.zip guetzli-master \
# https://github.com/docker-library/php/issues/240
&& rm /usr/bin/iconv \
&& curl -SL http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz | tar -xz -C . \
&& cd libiconv-1.14 \
&& ./configure --prefix=/usr/local \
&& curl -SL https://raw.githubusercontent.com/mxe/mxe/7e231efd245996b886b501dad780761205ecf376/src/libiconv-1-fixes.patch | patch -p1 -u \
&& make \
&& make install \
&& libtool --finish /usr/local/lib \
&& cd .. \
&& rm -rf libiconv-1.14
# Install extensions
{%- if version == '7.4' %}
&& docker-php-ext-configure gd --with-jpeg --with-freetype --with-webp \
Expand Down Expand Up @@ -286,6 +298,7 @@
autoconf \
g++ \
make \
libtool \
pcre-dev \
gettext-dev \
freetype-dev \
Expand Down

0 comments on commit 87b70d2

Please sign in to comment.