docker技巧

dockerfile 之php5.6.32扩展安装memcache memcachd redis mongodb

FROM php56:v1

LABEL maintainer=”moneyslow”

RUN apk update && apk add autoconf openssl-dev g++ make && \

    pecl install mongo && \

    docker-php-ext-enable mongo

RUN apk add –no-cache –virtual .build-deps pcre-dev && \

    pecl install mongodb && \

    docker-php-ext-enable mongodb

RUN apk add rsync php5-memcache php5-mysql php5-mssql php5-bz2 php5-bcmath php5-pcntl php5-sockets php5-sysvsem php5-gettext && \

    rsync -avzP /etc/php5/conf.d/*.ini /usr/local/etc/php/conf.d/ && \

    rsync -avzP /usr/lib/php5/modules/*.so /usr/local/lib/php/extensions/no-debug-non-zts-20131226/

RUN apk –update add openssh-client libtool make grep autoconf gcc libc-dev zlib-dev libmemcached-dev

RUN cd /tmp \

    && apk –update add cyrus-sasl-dev libmemcached-dev \

    && curl -L –progress-bar -o “php-memcached-2.2.0.tar.gz” “https://github.com/php-memcached-dev/php-memcached/archive/2.2.0.tar.gz” \

    && tar -xzvf php-memcached-2.2.0.tar.gz \

    && cd php-memcached-2.2.0 \

    && phpize \

    && ./configure –disable-memcached-sasl \

    && make \

    && make install \

    && docker-php-ext-enable memcached \

    && cd .. \

    && rm -rf php-memcached-2.2.0 \

    && rm php-memcached-2.2.0.tar.gz

RUN apk update && apk add autoconf openssl-dev g++ make \

    && pecl install -o -f redis \

    && rm -rf /tmp/pear \

    && echo “extension=redis.so” > /usr/local/etc/php/conf.d/docker-php-ext-redis.ini

RUN apk del –purge autoconf openssl-dev g++ make