Browse Source

refactor: compile gnu-libiconv locally

master
Dnomd343 3 years ago
parent
commit
171b55c05f
  1. 12
      Dockerfile
  2. 22
      conf/docker/iconv.sh

12
Dockerfile

@ -1,10 +1,16 @@
FROM alpine as iconv
COPY ./conf/docker/iconv.sh /
RUN sh /iconv.sh
FROM alpine
LABEL maintainer="dnomd343"
COPY . /var/www/echoIP
ADD ./conf/docker/init.sh /
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
RUN apk --update add --no-cache nginx curl nodejs php7 php7-fpm php7-json php7-iconv php7-sqlite3 php7-openssl php7-mbstring gnu-libiconv && \
COPY --from=iconv /tmp/iconv/ /usr/local/lib/
RUN apk --update add --no-cache nginx curl nodejs php7 php7-fpm php7-json php7-iconv php7-sqlite3 php7-openssl php7-mbstring && \
rm /usr/lib/php7/modules/iconv.so && ln -s /usr/local/lib/iconv.so /usr/lib/php7/modules/ && \
mv /usr/local/lib/libiconv.so /usr/local/lib/libiconv.so.2 && \
mkdir -p /run/nginx && touch /run/nginx/nginx.pid && \
cp /var/www/echoIP/conf/docker/init.sh / && \
cp /var/www/echoIP/conf/docker/ip.conf /etc/nginx/echoip.conf && \
cp -f /var/www/echoIP/conf/docker/nginx.conf /etc/nginx/nginx.conf && \
cp /var/www/echoIP/conf/docker/init.sh / && \

22
conf/docker/iconv.sh

@ -0,0 +1,22 @@
apk add --update wget php7 php7-dev build-base autoconf re2c libtool
mkdir -p /tmp
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz -O /tmp/libiconv.tar.gz
tar xf /tmp/libiconv.tar.gz -C /tmp
cd /tmp/libiconv-1.16/
sed -i 's/_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");/#if HAVE_RAW_DECL_GETS\n_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");\n#endif/g' srclib/stdio.in.h
./configure --prefix=/usr/local
make && make install
php_version=`php -r "phpinfo();" | grep "PHP Version" | head -1`
php_version=${php_version#*=> }
wget http://php.net/distributions/php-$php_version.tar.gz -O /tmp/php.tar.gz
tar xf /tmp/php.tar.gz -C /tmp
cd /tmp/php-$php_version/ext/iconv
phpize
./configure --with-iconv=/usr/local
make && make install
mkdir /tmp/iconv
cp /usr/local/lib/libiconv.so /tmp/iconv
cp /usr/lib/php7/modules/iconv.so /tmp/iconv
Loading…
Cancel
Save