首页 > 技术文章 > Dockerfile

g120992880 2017-10-30 19:58 原文

FROM centos:6

MAINTAINER GSMFAN

#apache2.4.29 and php5.5.38
ADD apr-1.6.3.tar.gz /usr/local/src
ADD apr-util-1.6.1.tar.gz /usr/local/src
ADD httpd-2.4.29.tar.bz2 /usr/local/src
ADD php-5.5.38.tar.bz2 /usr/local/src

RUN yum install -y epel-release gcc perl expat-devel pcre-devel
RUN yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-turbo-devel libpng-devel libXpm-devel freetype-devel libmcrypt-devel
RUN yum clean all

WORKDIR /usr/local/src/apr-1.6.3
RUN ./configure --prefix=/usr/local/apr
RUN make
RUN make install

WORKDIR /usr/local/src/apr-util-1.6.1
RUN ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
RUN make
RUN make install

WORKDIR /usr/local/src/httpd-2.4.29
RUN ./configure --enable-mods-shared=all --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
RUN make
RUN make install

RUN echo "ServerName localhost:80" >> /usr/local/apache2/conf/httpd.conf


WORKDIR /usr/local/src/php-5.5.38
RUN ./configure --prefix=/usr/local/php55 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-xpm-dir \
--with-freetype-dir \
--enable-mbstring \
--with-gettext \
--enable-fpm \
--enable-debug \
--with-mcrypt \
--with-pdo-mysql \
--enable-soap \
--with-openssl \
--with-curl
RUN make
RUN make install

RUN cp php.ini-production /usr/local/php55/lib/php.ini

WORKDIR /usr/local/apache2/conf/
RUN sed -i '/<IfModule mime_module>/a\    AddType application/x-httpd-php .php\n    AddType applicaiton/x-httpd-php-source .phps' httpd.conf

ENTRYPOINT /usr/local/apache2/bin/httpd -D FOREGROUND

 

推荐阅读