1.保存成 Dockerfile 文件
FROM ubuntu:18.04
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai
RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean \
&& apt-get update \
&& apt-get upgrade -y
RUN apt-get install -y wget bison re2c autoconf libxml2-dev build-essential \
openssl libssl-dev curl libcurl4-gnutls-dev libjpeg-dev \
libpng-dev libmcrypt-dev libreadline6-dev libfreetype6 libfreetype6-dev libzip-dev
RUN ln -s $(find / -name libssl.so) /usr/lib && ln -s /usr/include/x86_64-linux-gnu/curl/ /usr/include/curl
RUN cd /var/tmp/ \
&& wget -c https://github.com/php/php-src/archive/refs/tags/php-7.3.9.tar.gz \
&& tar -zxvf php-7.3.9.tar.gz \
&& cd php-src-php-7.3.9/ \
&& ./buildconf --force \
&& ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-fpm \
--with-fpm-user="www" \
--with-fpm-group="www" \
--with-mysqli \
--with-pdo-mysql \
--with-iconv-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--enable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--with-mcrypt \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--enable-fileinfo \
--enable-maintainer-zts \
&& make -j6 \
&& make install \
&& ln -s /usr/local/php/sbin/* /usr/local/bin/ \
&& ln -s /usr/local/php/bin/* /usr/local/bin/ \
&& cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf \
&& cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf \
&& groupadd www \
&& useradd -g www www \
&& php-fpm
2.编译成镜像
docker build -f ./Dockerfile t php73 .
网友评论