alpine系統php8的dockerfile(swoole使用)

wd731869706發表於2022-01-11

這個是自己搭配swoole使用,有其他需求的需要自己處理一下哈,markdown有點問題"\"解析不出來,需要修改一下哈~

FROM alpine:latest

MAINTAINER zhaohao731869706@163.com

ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8

RUN set -ex
    && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
    && apk update
    && apk upgrade
    && apk add --no-cache
        gcc
        g++
        libffi-dev
        openssl
        openssl-dev
        libtool
        libc-dev
        make
        autoconf
        libevent
        zip
        unzip
        curl
        wget
        librdkafka
        librdkafka-dev
        php8
        php8-dev
        php8-apcu
        php8-pecl-amqp
        php8-bcmath
        php8-ctype
        php8-curl
        php8-calendar
        php8-exif
        php8-pecl-event
        php8-fileinfo
        php8-ftp
        php8-gd
        php8-gettext
        php8-iconv
        php8-pecl-igbinary
        php8-intl
        php8-imap
        php8-pecl-imagick
        php8-json
        php8-ldap
        php8-mbstring
        php8-pecl-msgpack
        php8-mysqli
        php8-mysqlnd
        php8-mongodb
        php8-pecl-memcached
        php8-opcache
        php8-openssl
        php8-pcntl
        php8-pdo
        php8-pdo_mysql
        php8-pdo_sqlite
        php8-phar
        php8-posix
        php8-pecl-protobuf
        php8-redis
        php8-pecl-rdkafka
        php8-session
        php8-shmop
        php8-sockets
        php8-sqlite3
        php8-simplexml
        php8-sysvshm
        php8-pecl-mcrypt
        php8-dom
        php8-redis
        php8-tokenizer
        php8-xml
        php8-xmlreader
        php8-xmlwriter
        php8-xsl
        php8-zip
    && ln -s /usr/bin/php8  /usr/bin/php
    && ln -s /usr/bin/php-config8  /usr/bin/php-config
    && ln -s /usr/bin/phpize8  /usr/bin/phpize
    && 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/php8/conf.d/99-swoole.ini
    && echo "swoole.use_shortname=off" >> /etc/php8/conf.d/99-swoole.ini
    && sed -i -e 's@upload_max_filesize = 2M@upload_max_filesize = 128M@g' /etc/php8/php.ini
    && sed -i -e 's@post_max_size = 8M@post_max_size = 128M@g' /etc/php8/php.ini
    && sed -i -e 's@memory_limit = 128M@memory_limit = 1G@g' /etc/php8/php.ini
    && echo "opcache.enable=1" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.enable_cli=1" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.memory_consumption=200" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.max_wasted_percentage=5" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.save_comments=1" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.interned_strings_buffer=8" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.max_accelerated_files=100000" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.fast_shutdown=1" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.revalidate_freq=120" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit=1205" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_buffer_size=128M" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_prof_threshold=0.005" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_max_root_traces=1024" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_max_side_traces=128" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_max_exit_counters=8192" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_hot_loop=64" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_hot_func=127" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_hot_return=8" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_hot_side_exit=8" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_blacklist_root_trace=16" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_blacklist_side_trace=8" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_max_loop_unrolls=8" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_max_recursive_calls=2" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_max_recursive_returns=2" >> /etc/php8/conf.d/00_opcache.ini
    && echo "opcache.jit_max_polymorphic_calls=2" >> /etc/php8/conf.d/00_opcache.ini
    && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
    && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
    && rm -rf /var/cache/apk/* /tmp/* /usr/share/man /go-pear.phar

EXPOSE 9501

CMD ["php", "-a"]
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章