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

2020年1月8日11:15:40 评论
前言

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

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

php-5.4.45 对应安装的扩展需要的软件包下载链接,自行下载,然后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.7.1.tgz
http://pecl.php.net/get/mongo-1.6.11.tgz
http://pecl.php.net/get/yaf-2.3.4.tgz
https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
http://pecl.php.net/get/memcached-2.2.0.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-5.4.45.tar.gz /usr/local/src
ADD rabbitmq-c-0.8.0.tar.gz /usr/local/src
ADD amqp-1.7.1.tgz /usr/local/src
ADD mongo-1.6.11.tgz /usr/local/src
ADD yaf-2.3.4.tgz /usr/local/src
ADD libmemcached-1.0.18.tar.gz /usr/local/src
ADD memcached-2.2.0.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 && 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 -y install wget && groupadd www && useradd -g www www && \
       yum -y -y install openssl openssl-devel libxml2 libxml2-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel freetype gmp gmp-devel icu libicu libicu-devel libmcrypt unixODBC  unixODBC-devel gettext zlib pcre libpng libpng-devel freetype-devel  gcc-c++ libmcrypt-devel libxslt-devel m4 autoconf && \
       yum install -y epel-release && yum install -y libmcrypt-devel && \
       /usr/local/src/php-5.4.45/configure  \
			--prefix=/usr/local/php-5.4.45 --with-config-file-path=/usr/local/php-5.4.45/etc \
			--with-gettext \
			--with-gmp \
			--with-mysql \
			--with-openssl \
			--with-pdo-mysql \
			--with-mysqli \
			--with-bz2 \
			--with-curl \
			--with-mcrypt \
			--with-mhash \
			--with-freetype-dir \
			--with-unixODBC=/usr/ \
			--with-pdo-odbc=unixODBC,/usr/ \
			--with-libxml-dir \
			--with-zlib \
			--with-pcre-dir \
			--with-gd \
			--with-jpeg-dir \
			--with-png-dir \
			--with-xmlrpc \
			--with-libxml-dir \
			--with-xsl \
			--enable-soap \
			--enable-sysvmsg \
			--enable-wddx \
			--enable-zip \
			--enable-exif \
			--enable-intl \
			--enable-bcmath \
			--enable-calendar \
			--enable-mbstring \
			--enable-shmop \
			--enable-fpm \
			--with-fpm-user=www \
			--with-fpm-group=www \
			--enable-sockets && make install && \

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

		cd /usr/local/src/rabbitmq-c-0.8.0 && \
		./configure --prefix=/usr/local/rabbitmq-0.8.0 && \
		make install && cd .. && \

		cd amqp-1.7.1 && \
		/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 mongo-1.6.11 && \
		/usr/local/php/bin/phpize && \
		./configure --with-php-config=/usr/local/php/bin/php-config && \
		make install && cd .. && \

		cd yaf-2.3.4 && \
		/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-2.2.0 && \
		/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=mongo.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.conf && \
        sed -i -e 's@listen.allowed_clients = 127.0.0.1@;listen.allowed_clients = 127.0.0.1@g' /usr/local/php/etc/php-fpm.conf && \
        sed -i 's@;daemonize = yes@daemonize = no@g' /usr/local/php/etc/php-fpm.conf && \
        sed -i 's/date.timezone =/date.timezone = "Asia/Shanghai"/g' /usr/local/php/etc/php.ini && \
        sed -i 's/prefix=@prefix@/prefix=/usr/local/php-5.4.45/g' /etc/init.d/php-fpm && \
        sed -i 's/exec_prefix=@exec_prefix@/exec_prefix=${prefix}/g' /etc/init.d/php-fpm && \
        sed -i 's/php_fpm_BIN=@sbindir@/php-fpm/php_fpm_BIN=${exec_prefix}/sbin/php-fpm/g' /etc/init.d/php-fpm && \
        sed -i 's/php_fpm_CONF=@sysconfdir@/php-fpm.conf/php_fpm_CONF=${prefix}/etc/php-fpm.conf/g' /etc/init.d/php-fpm && \
        sed -i 's/php_fpm_PID=@localstatedir@/run/php-fpm.pid/php_fpm_PID=${prefix}/logs/php-fpm.pid/g' /etc/init.d/php-fpm && \
        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: