Created
December 8, 2016 16:04
-
-
Save jacobsantos/149f424aecfc55701f03ca1aa15fa474 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:xenial | |
ARG PHP_VERSION=5.5 | |
ARG LIBXL_BRANCH="master" | |
ARG LIBXL_VERSION="3.6.5" | |
ENV PHP_VERSION $PHP_VERSION | |
# LibXL PHPExcel | |
ENV LIBXL_SRC_DIR /opt/libxl | |
ENV PHPEXCEL_SRC_DIR /usr/src/phpexcel | |
ENV LIBXL_PACKAGES build-essential \ | |
curl \ | |
ca-certificates \ | |
git \ | |
libxml2-dev | |
ENV PHP_VERSIONED_PACKAGES curl \ | |
php${PHP_VERSION} \ | |
php${PHP_VERSION}-dev \ | |
php${PHP_VERSION}-bcmath \ | |
php${PHP_VERSION}-cli \ | |
php${PHP_VERSION}-common \ | |
php${PHP_VERSION}-curl \ | |
php${PHP_VERSION}-gd \ | |
php${PHP_VERSION}-intl \ | |
php${PHP_VERSION}-json \ | |
php${PHP_VERSION}-mbstring \ | |
php${PHP_VERSION}-mcrypt \ | |
php${PHP_VERSION}-mysql \ | |
php${PHP_VERSION}-opcache \ | |
php${PHP_VERSION}-readline \ | |
php${PHP_VERSION}-xml | |
ENV PHP_PACKAGES php-apcu \ | |
php-apcu-bc \ | |
php-cli \ | |
php-xdebug \ | |
php-common \ | |
php-igbinary \ | |
php-libsodium \ | |
php-memcached \ | |
php-msgpack \ | |
php-pear | |
RUN set -ex \ | |
&& DEBIAN_FRONTEND=noninteractive apt-get update \ | |
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install python3-software-properties software-properties-common \ | |
&& DEBIAN_FRONTEND=noninteractive LC_ALL=C.UTF-8 LANG=C.UTF-8 add-apt-repository -y ppa:ondrej/php \ | |
&& DEBIAN_FRONTEND=noninteractive LC_ALL=C.UTF-8 apt-get update \ | |
&& DEBIAN_FRONTEND=noninteractive LC_ALL=C.UTF-8 apt-get --no-install-recommends -y install $PHP_VERSIONED_PACKAGES $PHP_PACKAGES $LIBXL_PACKAGES \ | |
# Composer | |
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ | |
\ | |
#LibXL | |
&& ( \ | |
curl -fsSL "http://www.libxl.com/download/libxl-lin-${LIBXL_VERSION}.tar.gz" -o /tmp/libxl.tar.gz \ | |
&& tar zxvf /tmp/libxl.tar.gz --directory /tmp/ \ | |
&& mkdir -p $LIBXL_SRC_DIR \ | |
&& ls -la /tmp/libxl-* \ | |
&& cp -r /tmp/libxl-${LIBXL_VERSION}.0/* $LIBXL_SRC_DIR \ | |
&& ls -la $LIBXL_SRC_DIR \ | |
) \ | |
# PHP Excel extension | |
&& ( \ | |
git clone https://github.com/iliaal/php_excel.git -b ${LIBXL_BRANCH} $PHPEXCEL_SRC_DIR \ | |
&& cd $PHPEXCEL_SRC_DIR \ | |
&& eval $(which phpize${PHP_VERSION}) \ | |
&& ./configure --with-php-config=$(which php-config${PHP_VERSION}) --with-libxl-incdir=$LIBXL_SRC_DIR/include_c/ --with-libxl-libdir=$LIBXL_SRC_DIR/lib64/ --with-excel=$LIBXL_SRC_DIR --with-libxml-dir=/usr/include/libxml2 \ | |
&& make \ | |
&& make install \ | |
&& echo -e "extension=excel.so" > /etc/php/${PHP_VERSION}/mods-available/excel.ini \ | |
&& ln -s /etc/php/${PHP_VERSION}/mods-available/excel.ini /etc/php/${PHP_VERSION}/cli/conf.d/20-excel.ini \ | |
) \ | |
# Cleanup packages | |
&& DEBIAN_FRONTEND=noninteractive LC_ALL=C.UTF-8 apt-get remove --purge -y $LIBXL_PACKAGES python3-software-properties software-properties-common \ | |
&& DEBIAN_FRONTEND=noninteractive LC_ALL=C.UTF-8 apt-get autoremove -y \ | |
&& DEBIAN_FRONTEND=noninteractive LC_ALL=C.UTF-8 apt-get clean \ | |
&& rm -rf $PHPEXCEL_SRC_DIR /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* | |
WORKDIR /usr/share/app/ | |
CMD bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment