1. 程式人生 > >PHP5.6 Dockerfile

PHP5.6 Dockerfile

FROM centos

COPY ["src","/src"]

RUN groupadd -g 1000 www \
    && useradd -u 1000 -g www -s /sbin/nologin www ;\
    yum -y install \
    make \
    file \
    autoconf \
    libtool \
    gcc gcc-c++\
    openssl openssl-devel \
    zlib zlib-devel \
    bzip2 \
    libmemcached libmemcached-devel \
    libevent libevent-devel \
    && ln -sv /lib64/libssl.so.1.0.2k /usr/lib/libssl.so \
    && ln -sv /lib64/bssl3.so /usr/lib/libssl3.so \
    && ln -sv /lib64/libssl.so.1.0.2k /usr/lib/libssl.so.10 \
    && ln -sv /lib64/libssh2.so.1.0.1 /usr/lib/libssh2.so.1 \
    && ldconfig \
    && yum clean all ;\
    cd /src/ \
    && tar xf libxml2-2.7.7.tar.gz \
    && cd libxml2-2.7.7/ \
    && ./configure --prefix=/usr/local/libxml >/dev/null \
    && make >/dev/null \
    && make install >/dev/null ;\
    cd /src/ \
    && tar xf curl-7.21.4.tar.gz \
    && cd curl-7.21.4/ \
    && ./configure --prefix=/usr/local/curl >/dev/null \
    && make >/dev/null \
    && make install >/dev/null ;\
    cd /src/ \
    && tar xf jpegsrc.v8b.tar.gz \
    && cd jpeg-8b/\
    && ./configure --prefix=/usr/local/jpeg >/dev/null \
    && make >/dev/null \
    && make install >/dev/null ;\
    cd /src/ \
    && tar xf libpng-1.4.3.tar.gz \
    && cd libpng-1.4.3/ \
    && ./configure --prefix=/usr/local/libpng >/dev/null \
    && make >/dev/null \
    && make install >/dev/null ;\
    cd /src/ \
    && tar xf freetype-2.4.1.tar.bz2 \
    && cd freetype-2.4.1/ \
    && ./configure --prefix=/usr/local/freetype >/dev/null \
    && make >/dev/null \
    && make install >/dev/null ;\
    cd /src/ \
    && tar xf libevent-2.0.10-stable.tar.gz \
    && cd libevent-2.0.10-stable/ \
    && ./configure --prefix=/usr/local/libevent--disable-debug-mode >/dev/null \
    && make >/dev/null \
    && make install >/dev/null ;\
    cd /src/ \
    && tar xf re2c-0.13.5.tar.gz \
    && cd re2c-0.13.5/ \
    && ./configure --prefix=/usr/local/re2c >/dev/null \
    && make >/dev/null \
    && make install >/dev/null ;\
    cd /src/ \
    && tar xf libmcrypt-2.5.8.tar.bz2 \
    && cd libmcrypt-2.5.8/ \
    && ./configure --prefix=/usr/local/libmcrypt >/dev/null \
    && make >/dev/null \
    && make install >/dev/null ;\
    cd /src/ \
    && tar xf php-5.6.30.tar.bz2 \
    && cd php-5.6.30 \
    && CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=nocona -O2 -pipe" CXXFLAGS="-march=nocona -O2 -pipe" \ 
    ./configure --prefix=/usr/local/php \
    --enable-fpm  \
    --enable-mbstring \
    --enable-sockets \
    --enable-pdo \
    --enable-zip \
    --enable-fpm \
    --with-gd \
    --with-fpm-user=www \
    --with-fpm-group=www \
    --with-zlib \
    --with-config-file-path=/usr/local/php/etc \
    --with-mysql=mysqlnd \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --prefix=/usr/local/php \
    --with-pcre-dir=/usr/local/pcre \
    --enable-soap \
    --with-openssl-dir=/usr \
    --enable-mbstring \
    --enable-bcmath \
    --with-libxml-dir=/usr/local/libxml \
    --with-curl=/usr/local/curl \
    --with-png-dir=/usr/local/libpng \
    --with-jpeg-dir=/usr/local/jpeg \
    --with-freetype-dir=/usr/local/freetype \
    --with-gettext \
    && make -j`grep -c processor /proc/cpuinfo` > /dev/null \
    && make install > /dev/null \
    && cp -f /src/php-fpm.conf /usr/local/php/etc/php-fpm.conf \
    && cp -f /src/php56.ini /usr/local/php/etc/php56.ini \
    && ln -s /usr/local/php/etc/php56.ini /usr/local/php/etc/php.ini \
    && ln -sf /usr/local/php/etc/php.ini /etc/php.ini \
    && mkdir -p /data/{logs,web} \
    && chown www:www -R /data/logs /data/web \
    && echo "/usr/local/php/sbin/php-fpm reload" > /root/php-fpm_reload \
    && chmod 700 /root/php-fpm_reload ;\
    cd /src/ \
    && tar xf memcache-2.2.7.tgz \
    && cd memcache-2.2.7 \
    && /usr/local/php/bin/phpize \
    && CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=nocona -O2 -pipe" CXXFLAGS="-march=nocona -O2 -pipe" ./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config \
    && make \
    && make install ;\
    cd /src/ \
    && tar xf memcached-2.2.0.tgz \
    && cd memcached-2.2.0 \
    && /usr/local/php/bin/phpize --clean \
    && /usr/local/php/bin/phpize \
    && ./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config \
    && make \ 
    && make install ;\
    cd / ;\
    rm -rf /src ;\
    yum remove -y iputils* \
    bind* \
    vim* \
    make \
    cpp \
    acl \
    rootfiles \
    file \
    tar \
    python-chardet \
    gobject-introspection \
    libxml2-python \
    python-gobject-base \
    basesystem \
    libgomp \
    libstdc++-devel \
    glibc-headers \
    mpfr \
    passwd \
    yum-plugin-ovl \
    dbus-glib \
    python-kitchen \
    kernel-headers \
    && yum clean all;\
    userdel mail ;\
    userdel ftp ;\
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/ ;\
    ln -svf /etc/Shanghai /etc/localtime ;\
    rm -rf /src /root/.bash* /root/.cshrc  /root/.tcshrc /var/cache /usr/share/zoneinfo 

EXPOSE 9000
CMD ["/usr/local/php/sbin/php-fpm","--fpm-config","/usr/local/php/etc/php-fpm.conf"]