Last active
February 5, 2020 07:54
-
-
Save simonkuang/050f5d01cb1236606eb55c3237afecd5 to your computer and use it in GitHub Desktop.
从 php:7.3-fpm 开始的镜像 build file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.3-fpm | |
MAINTAINER Simon Kuang<me@simonkuang.com> | |
RUN ([ -f /etc/apt/sources.list ] && mv /etc/apt/sources.list /etc/apt/sources.list.bak) \ | |
&& echo "# Tsinghua Tuna Mirror" > /etc/apt/sources.list \ | |
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib" >> /etc/apt/sources.list \ | |
&& echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib" >> /etc/apt/sources.list \ | |
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main" >> /etc/apt/sources.list \ | |
&& echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main" >> /etc/apt/sources.list \ | |
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib" >> /etc/apt/sources.list \ | |
&& echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib" >> /etc/apt/sources.list \ | |
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main non-free contrib" >> /etc/apt/sources.list \ | |
&& echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main non-free contrib" >> /etc/apt/sources.list \ | |
&& apt-get update | |
# && echo "# Aliyun Mirror" > /etc/apt/sources.list \ | |
# && echo "deb http://mirrors.aliyun.com/debian/ buster main non-free contrib" >> /etc/apt/sources.list \ | |
# && echo "deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib" >> /etc/apt/sources.list \ | |
# && echo "deb http://mirrors.aliyun.com/debian-security buster/updates main" >> /etc/apt/sources.list \ | |
# && echo "deb-src http://mirrors.aliyun.com/debian-security buster/updates main" >> /etc/apt/sources.list \ | |
# && echo "deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >> /etc/apt/sources.list \ | |
# && echo "deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >> /etc/apt/sources.list \ | |
# && echo "deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >> /etc/apt/sources.list \ | |
# && echo "deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >> /etc/apt/sources.list \ | |
# && apt update | |
RUN apt-get install -y --fix-missing zlib1g-dev libpng-dev libwebp-dev libfreetype6-dev libjpeg62-turbo-dev \ | |
&& docker-php-ext-configure gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr --with-webp-dir=/usr \ | |
&& docker-php-ext-install -j$(nproc) gd \ | |
&& apt-get install -y --fix-missing libbz2-dev \ | |
&& docker-php-ext-configure bz2 --with-bz2=/usr \ | |
&& docker-php-ext-install -j$(nproc) bz2 \ | |
&& docker-php-ext-configure calendar --enable-calendar \ | |
&& docker-php-ext-install -j$(nproc) calendar \ | |
&& docker-php-ext-configure exif --enable-exif \ | |
&& docker-php-ext-install -j$(nproc) exif \ | |
&& apt-get install -y --fix-missing libgettextpo-dev \ | |
&& docker-php-ext-configure gettext --with-gettext=/usr \ | |
&& docker-php-ext-install -j$(nproc) gettext \ | |
&& docker-php-ext-configure mysqli --enable-embedded-mysqli --with-mysql-sock=/tmp/mysql.sock \ | |
&& docker-php-ext-install -j$(nproc) mysqli \ | |
&& docker-php-ext-configure pcntl --enable-pcntl \ | |
&& docker-php-ext-install -j$(nproc) pcntl \ | |
&& docker-php-ext-configure pdo_mysql \ | |
&& docker-php-ext-install -j$(nproc) pdo_mysql \ | |
&& apt-get install -y --fix-missing libpq-dev \ | |
&& docker-php-ext-configure pdo_pgsql \ | |
&& docker-php-ext-install -j$(nproc) pdo_pgsql \ | |
&& apt-get install -y --fix-missing libpq-dev \ | |
&& docker-php-ext-configure pgsql --with-pgsql=/usr \ | |
&& docker-php-ext-install -j$(nproc) pgsql \ | |
&& docker-php-ext-configure shmop \ | |
&& docker-php-ext-install -j$(nproc) shmop \ | |
&& docker-php-ext-configure sockets \ | |
&& docker-php-ext-install -j$(nproc) sockets \ | |
&& docker-php-ext-configure sysvmsg \ | |
&& docker-php-ext-install -j$(nproc) sysvmsg \ | |
&& docker-php-ext-configure sysvsem \ | |
&& docker-php-ext-install -j$(nproc) sysvsem \ | |
&& docker-php-ext-configure sysvshm \ | |
&& docker-php-ext-install -j$(nproc) sysvshm \ | |
&& apt-get install -y --fix-missing libxml2-dev libxslt1-dev \ | |
&& docker-php-ext-configure wddx \ | |
&& docker-php-ext-install -j$(nproc) wddx \ | |
&& apt-get install -y --fix-missing libxslt1-dev \ | |
&& docker-php-ext-configure xsl \ | |
&& docker-php-ext-install -j$(nproc) xsl \ | |
&& apt-get install -y --fix-missing libzip-dev \ | |
&& docker-php-ext-configure zip \ | |
&& docker-php-ext-install -j$(nproc) zip | |
RUN apt-get install -y --fix-missing libgeoip-dev \ | |
&& mkdir -p /data/soft \ | |
&& curl -Lo /data/soft/geoip-1.1.1.tgz https://pecl.php.net/get/geoip-1.1.1.tgz \ | |
&& tar -C /data/soft -zxf /data/soft/geoip-1.1.1.tgz \ | |
&& cd /data/soft/geoip-1.1.1 \ | |
&& phpize \ | |
&& ./configure --with-geoip \ | |
&& make && make install \ | |
&& echo 'extension=geoip.so' > /usr/local/etc/php/conf.d/docker-php-ext-geoip.ini | |
RUN mkdir -p /data/soft \ | |
&& curl -Lo /data/soft/igbinary-3.1.0.tgz http://pecl.php.net/get/igbinary-3.1.0.tgz \ | |
&& tar -C /data/soft -zxf /data/soft/igbinary-3.1.0.tgz \ | |
&& cd /data/soft/igbinary-3.1.0 \ | |
&& phpize \ | |
&& ./configure --enable-igbinary \ | |
&& make && make install \ | |
&& echo 'extension=igbinary.so' > /usr/local/etc/php/conf.d/docker-php-ext-igbinary.ini | |
RUN pecl install mongodb \ | |
&& echo 'extension=mongodb.so' > /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini | |
RUN apt-get install -y --fix-missing libmcrypt-dev \ | |
&& yes autodetect | pecl install mcrypt \ | |
&& echo 'extension=mcrypt.so' > /usr/local/etc/php/conf.d/docker-php-ext-mcrypt.ini | |
RUN yes no | pecl install redis \ | |
&& echo 'extension=redis.so' > /usr/local/etc/php/conf.d/docker-php-ext-redis.ini | |
RUN apt-get install -y --fix-missing libleveldb-dev \ | |
&& pecl install channel://pecl.php.net/leveldb-0.2.1 \ | |
&& echo 'extension=leveldb.so' > /usr/local/etc/php/conf.d/docker-php-ext-leveldb.ini | |
RUN apt-get install -y --fix-missing libssl-dev libnghttp2-dev \ | |
&& mkdir -p /data/soft \ | |
&& curl -Lo /data/soft/swoole-src-4.4.14.tar.gz https://github.com/swoole/swoole-src/archive/v4.4.14.tar.gz \ | |
&& tar -C /data/soft -zxf /data/soft/swoole-src-4.4.14.tar.gz \ | |
&& cd /data/soft/swoole-src-4.4.14 \ | |
&& phpize \ | |
&& ./configure --enable-http2 --enable-sockets --enable-mysqlnd --enable-openssl \ | |
&& make -j$(nproc) && make install \ | |
&& echo 'extension=swoole.so' > /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini | |
RUN mkdir -p /tmp && cd /tmp \ | |
&& curl -Lo /tmp/composer.phar https://mirrors.aliyun.com/composer/composer.phar \ | |
&& chmod +x /tmp/composer.phar \ | |
&& mv /tmp/composer.phar /usr/bin/ \ | |
&& [ ! -L /usr/bin/composer ] && ln -s /usr/bin/composer.phar /usr/bin/composer \ | |
&& composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ \ | |
&& [ $(echo $PATH | grep "\.config/composer" | grep -v grep | wc -l) -gt 0 ] || \ | |
echo 'export PATH+=:$HOME/.config/composer/vendor/bin' >> $HOME/.bashrc | |
ENV PATH $PATH:$HOME/bin:$HOME/.config/composer/vendor/bin | |
ENV PHP_INI_DIR /usr/local/etc/php | |
WORKDIR /var/www/html | |
#ENTRYPOINT docker-php-entrypoint | |
#CMD php-fpm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment