基于centos 7 做的PHP-7.1.18的docker镜像

2020年1月8日11:26:13 评论
前言

基于centos 7 做的PHP-7.1.18的docker镜像

PHP-7.1.18第三方扩展下载地址展开

php-7以上版本 对应安装的扩展需要的软件包下载链接,自行下载,然后add到dockerfile里
https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz
http://pecl.php.net/get/amqp-1.9.3.tgz
http://pecl.php.net/get/mongodb-1.5.3.tgz
http://pecl.php.net/get/yaf-3.0.7.tgz
https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
http://pecl.php.net/get/memcached-3.1.3.tgz
http://www.imagemagick.org/download/ImageMagick-7.0.8-40.tar.gz
http://pecl.php.net/get/imagick-3.4.3.tgz

FROM centos:7

MAINTAINER gr

ADD php-7.1.18.tar.gz /usr/local/src
ADD rabbitmq-c-0.8.0.tar.gz /usr/local/src
ADD amqp-1.9.3.tgz /usr/local/src
ADD mongodb-1.5.3.tgz /usr/local/src
ADD yaf-3.0.7.tgz /usr/local/src
ADD libmemcached-1.0.18.tar.gz /usr/local/src
ADD memcached-3.1.3.tgz /usr/local/src
ADD ImageMagick-7.0.8-40.tar.gz /usr/local/src
ADD imagick-3.4.3.tgz /usr/local/src

WORKDIR /usr/local/src

RUN     yum -y install wget gcc gcc-c++ && cd /etc/yum.repos.d/ && rm -rf ./* \
        && wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \
        && sed  -i '/aliyuncs/d' /etc/yum.repos.d/CentOS-Base.repo \
        && wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo \
        && sed -i '/aliyuncs/d' /etc/yum.repos.d/epel.repo \
        && yum clean all && yum makecache \

RUN     yum install -y epel-release && yum -y install libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel autoconf && \
        groupadd www && useradd -g www www && \
        /usr/local/src/php-7.1.18/configure \
            --prefix=/usr/local/php-7.1.18 --with-config-file-path=/usr/local/php-7.1.18/etc \
			--enable-fpm \
			--with-fpm-user=www \
			--with-fpm-group=www \
            --with-libxml-dir \
            --with-xmlrpc \
            --with-openssl \
            --with-mcrypt \
            --with-mhash \
            --with-pcre-regex \
            --with-sqlite3 \
            --with-zlib \
            --enable-bcmath \
            --with-iconv \
            --with-bz2 \
            --enable-calendar \
            --with-curl \
            --with-cdb \
            --enable-dom \
            --enable-exif \
            --enable-fileinfo \
            --enable-filter \
            --with-pcre-dir \
            --enable-ftp \
            --with-gd \
            --with-openssl-dir \
            --with-jpeg-dir \
            --with-png-dir \
            --with-zlib-dir \
            --with-freetype-dir \
            --enable-gd-native-ttf \
            --enable-gd-jis-conv \
            --with-gettext \
            --with-gmp \
            --with-mhash \
            --enable-json \
            --enable-mbstring \
            --enable-mbregex \
            --enable-mbregex-backtrack \
            --with-libmbfl \
            --with-onig \
            --enable-pdo \
            --with-mysqli=mysqlnd \
            --with-pdo-mysql=mysqlnd \
            --with-zlib-dir \
            --with-pdo-sqlite \
            --with-readline \
            --enable-session \
            --enable-shmop \
            --enable-simplexml \
            --enable-sockets \
            --enable-sysvmsg \
            --enable-sysvsem \
            --enable-sysvshm \
            --enable-wddx \
            --with-libxml-dir \
            --with-xsl \
            --enable-zip \
            --enable-mysqlnd-compression-support \
            --with-pear \
            --enable-opcache && make install && \

        cp -r /usr/local/src/php-7.1.18/php.ini-production /usr/local/php-7.1.18/etc/php.ini && \
		cp -r /usr/local/php-7.1.18/etc/php-fpm.conf.default /usr/local/php-7.1.18/etc/php-fpm.conf && \
		cp -r /usr/local/php-7.1.18/etc/php-fpm.d/www.conf.default /usr/local/php-7.1.18/etc/php-fpm.d/www.conf
		cp -r /usr/local/src/php-7.1.18/sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm && \
		ln -s /usr/local/php-7.1.18 /usr/local/php && \

		cd /usr/local/src/rabbitmq-c-0.8.0 && \
		./configure --prefix=/usr/local/rabbitmq-0.8.0 && \
		make install && cd .. && \
		wget http://pecl.php.net/get/amqp-1.9.3.tgz && \
		tar -zxvf amqp-1.9.3.tgz && cd amqp-1.9.3 && \
		/usr/local/php/bin/phpize && \
		./configure --with-php-config=/usr/local/php/bin/php-config  --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-0.8.0 && \
		make install && cd .. && \


		cd mongodb-1.5.3 && \
		/usr/local/php/bin/phpize && \
		./configure --with-php-config=/usr/local/php/bin/php-config && \
		make install && cd .. && \

		cd yaf-3.0.7 && \
		/usr/local/php/bin/phpize && \
		./configure --with-php-config=/usr/local/php/bin/php-config && \
		make install && cd .. && \

		cd libmemcached-1.0.18 && \
		./configure --prefix=/usr/local/libmemcached-1.0.18 --with-memcached && \
		make install && cd .. && \
		cd memcached-3.1.3 && \
		/usr/local/php/bin/phpize && \
		./configure  --with-php-config=/usr/local/php/bin/php-config  --enable-memcache --with-libmemcached-dir=/usr/local/libmemcached-1.0.18 --disable-memcached-sasl && \
		make install && cd .. && \

		cd ImageMagick-7.0.8-40 && \
		./configure -prefix=/usr/local/imagemagick && \
		make install && cd .. && \
		cd imagick-3.4.3 && \
		/usr/local/php/bin/phpize && \
		./configure  --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick && \
		make install && cd .. && \


		echo "extension=amqp.so" >> /usr/local/php/etc/php.ini && \
		echo "extension=mongodb.so" >> /usr/local/php/etc/php.ini && \
		echo "extension=imagick.so" >> /usr/local/php/etc/php.ini && \
		echo "extension=memcached.so" >> /usr/local/php/etc/php.ini && \
		echo "extension=yaf.so" >> /usr/local/php/etc/php.ini && \
		echo "/etc/init.d/php-fpm start" >> /etc/rc.local && \
		chmod -R 755 /etc/init.d/php-fpm

RUN     sed -i -e 's@listen = 127.0.0.1:9000@listen = 0.0.0.0:9000@g' /usr/local/php/etc/php-fpm.d/www.conf && \
        sed -i 's@;daemonize = yes@daemonize = no@g' /usr/local/php/etc/php-fpm.conf && \
        rm -rf /var/cache /usr/local/src

EXPOSE 9000

cmd ["/usr/local/php/sbin/php-fpm"]
weinxin
我的微信
这是我的微信扫一扫

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: