FROM bravedu/php-fpm:7.1.8
MAINTAINER  duchaoqun "duchaoqun@360.cn"
ENV   REFRESHED_AT 2017-9-26 17:01:12    
ENV INSTALL_LIB_DEP="wget zip unzip"

RUN apt-get update 
RUN apt-get install -y $INSTALL_LIB_DEP zlib1g-dev

RUN set -ex \
        && cd /opt \
        && wget https://github.com/phpredis/phpredis/archive/3.0.0.zip -O redis-3.0.0.zip \
        && unzip redis-3.0.0.zip \
        && cd phpredis-3.0.0 \
        && phpize \
        && ./configure \
        && make && make install \
        && echo "extension=redis.so" | tee /usr/local/etc/php/conf.d/redis.ini 

RUN set -ex \
        && cd /opt \
        && wget https://github.com/laruence/yaf/archive/yaf-3.0.4.zip -O yaf-3.0.4.zip \
        && unzip yaf-3.0.4.zip \
        && cd yaf-yaf-3.0.4 \
        && phpize \
        && ./configure \
        && make && make install \
        && sh -c 'echo "extension=yaf.so";' | tee /usr/local/etc/php/conf.d/yaf.ini

RUN set -ex \
        && cd /opt \
        && wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz -O libmemcached-1.0.18.tar.gz \
        && tar -zxf libmemcached-1.0.18.tar.gz \
        && cd libmemcached-1.0.18 \
        && ./configure \
        && make \
        && make install \
        && wget https://github.com/php-memcached-dev/php-memcached/archive/php7.zip -O memcached-php7.zip\
        && unzip memcached-php7.zip \
        && cd php-memcached-php7 \
        && phpize \
        && ./configure --disable-memcached-sasl \
        && make && make install \
        && echo "extension=memcached.so" | tee /usr/local/etc/php/conf.d/memcached.ini 

RUN apt-get install libssl-dev -y \
        &&  pecl install mongodb \
        &&  rm -rf /tmp/pear \
        &&  docker-php-ext-enable mongodb

RUN set -ex \
    && docker-php-ext-install -j$(nproc) iconv mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd

RUN apt-get remove -y $INSTALL_LIB_DEP && apt-get clean && rm -r /var/lib/apt/lists/*

RUN docker-php-ext-install sockets

RUN pecl install apcu-5.1.8 \
    && echo "extension=apcu.so\napc.enable_cli = 1" > /usr/local/etc/php/conf.d/ext-apcu.ini

CMD ["php-fpm"]