DockerFile

FROM harbor.ym/php-fpm/php56fpm
RUN apk add make gcc libc-dev libcurl curl-dev libpng libpng-dev openldap-dev postgresql-dev autoconf &&  
    cd /tmp && 
    wget "https://www.php.net/distributions/php-5.6.40.tar.gz" && 
    tar -xzvf php-5.6.40.tar.gz && cd php-5.6.40 && 
    ./configure --prefix=/usr/local/php5.6.40/  
    --with-config-file-path=/usr/local/php5.6.40/etc/ --with-config-file-scan-dir=/usr/local/php5.6.40/etc/conf/ 
    --enable-bcmath --with-curl --enable-exif --with-gd --with-ldap --enable-mbstring --with-mysql --with-mysqli --enable-pcntl --enable-opcache --with-pdo-mysql 
    --with-pdo-pgsql --without-pdo-sqlite --with-pgsql --enable-phpdbg --enable-maintainer-zts &&
    make && make install &&
    cp php.ini-production /usr/local/php5.6.40/etc/php.ini && 
    #add redis
    wget "https://pecl.php.net/get/redis-4.3.0.tgz" && tar -xzvf redis-4.3.0.tgz && cd redis-4.3.0 && /usr/local/php5.6.40/bin/phpize &&
    ./configure --with-php-config=/usr/local/php5.6.40/bin/php-config && make && make install && 
    mkdir /usr/local/php5.6.40/etc/conf &&
    echo extension=redis.so >> /usr/local/php5.6.40/etc/conf/redis.ini && 
    wget https://pecl.php.net/get/pthreads-2.0.10.tgz && tar -xzvf pthreads-2.0.10.tgz && cd pthreads-2.0.10 && /usr/local/php5.6.40/bin/phpize &&
    ./configure --with-php-config=/usr/local/php5.6.40/bin/php-config && make && make install && 
    echo extension=pthreads.so >> /usr/local/php5.6.40/etc/conf/redis.ini &&
    rm -rf /tmp/* && 
    apk del make gcc libc-dev libcurl curl-dev libpng libpng-dev openldap-dev postgresql-dev autoconf && 
    apk cache --purge
暗夜之中,才见繁星;危机之下,暗藏转机;事在人为,为者常成。
原文地址:https://www.cnblogs.com/zenghansen/p/14636072.html