2023-03-23 15:19:34
浏览数 (2)
- 目前这个build的dockerfile只用在测试开发环境哈,需要优化opcache啥的自己开启一下哈
代码语言:javascript
复制FROM centos:8
MAINTAINER zhaohao731869706@163.com
ENV PHP_VERSION=8.1
ENV LANG=C.UTF-8
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN rm /etc/yum.repos.d/*.repo
&& curl https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo --output /etc/yum.repos.d/CentOS-Base.repo
&& yum clean all && yum makecache && yum clean packages
&& yum install -y openssl-devel gcc-c make autoconf zip unzip git lsof telnet vim wget
&& dnf module reset php
&& dnf install epel-release -y
&& dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
&& wget http://rpms.famillecollet.com/enterprise/remi-release-8.rpm
&& rpm -ivh remi-release-8.rpm --nodeps --force
&& yes y|dnf module enable php:remi-${PHP_VERSION} -y
&& dnf install php php-devel libmemcached php-pecl-rdkafka php-pecl-apcu php-posix php-pcntl php-gd php-dba php-gmp php-intl php-ldap php-odbc php-soap php-tidy php-pecl-zip php-bcmath php-ast php-pecl-amqp php-pecl-mongodb php-pecl-imagick php-pecl-protobuf php-pecl-memcached php-pecl-memcache php-openssl php-json php-mysqlnd php-sockets php-fpm php-mbstring boost boost-devel -y
&& sed -i -e 's@upload_max_filesize = 2M@upload_max_filesize = 100M@g' /etc/php.ini
&& sed -i -e 's@post_max_size = 8M@post_max_size = 108M@g' /etc/php.ini
&& sed -i -e 's@memory_limit = 128M@memory_limit = 1024M@g' /etc/php.ini
&& sed -i -e 's@;date.timezone =@date.timezone = Asia/Shanghai@g' /etc/php.ini
&& sed -i -e 's@opcache.enable=1@opcache.enable=0@g' /etc/php.d/10-opcache.ini
&& sed -i -e 's@opcache.enable_cli=1@opcache.enable_cli=0@g' /etc/php.d/10-opcache.ini
&& sed -i -e 's@;opcache.memory_consumption=125@opcache.memory_consumption=200@g' /etc/php.d/10-opcache.ini
&& sed -i -e 's@;opcache.max_wasted_percentage=5@opcache.max_wasted_percentage=5@g' /etc/php.d/10-opcache.ini
&& sed -i -e 's@;opcache.save_comments=1@opcache.save_comments=1@g' /etc/php.d/10-opcache.ini
&& sed -i -e 's@;opcache.interned_strings_buffer=8@opcache.interned_strings_buffer=8@g' /etc/php.d/10-opcache.ini
&& sed -i -e 's@;opcache.max_accelerated_files=10000@opcache.max_accelerated_files=10000@g' /etc/php.d/10-opcache.ini
&& sed -i -e 's@;opcache.revalidate_freq=2@opcache.revalidate_freq=20@g' /etc/php.d/10-opcache.ini
&& echo "opcache.fast_shutdown=1" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit=1205" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_buffer_size=128M" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_prof_threshold=0.005" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_max_root_traces=1024" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_max_side_traces=128" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_max_exit_counters=8192" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_hot_loop=64" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_hot_func=127" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_hot_return=8" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_hot_side_exit=8" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_blacklist_root_trace=16" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_blacklist_side_trace=8" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_max_loop_unrolls=8" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_max_recursive_calls=2" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_max_recursive_returns=2" >> /etc/php.d/10-opcache.ini
&& echo "opcache.jit_max_polymorphic_calls=2" >> /etc/php.d/10-opcache.ini
&& wget http://pear.php.net/go-pear.phar
&& php go-pear.phar
&& pecl channel-update pecl.php.net
&& yes|pecl install swoole
&& echo "extension=swoole.so" > /etc/php.d/99-swoole.ini
&& echo "swoole.use_shortname=off" >> /etc/php.d/99-swoole.ini
&& pecl install redis
&& echo "extension=redis.so" > /etc/php.d/99-redis.ini
&& curl -sS https://getcomposer.org/installer | php
&& mv composer.phar /usr/bin/composer
&& composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
&& rm -rf /tmp /remi-release-8.rpm /go-pear.phar
&& yum clean all
ENTRYPOINT ["/usr/sbin/init"]