- 獲取官方PHP7.1-cli鏡像,并在此基礎(chǔ)上進(jìn)行修改
- 修改apt源為163的源
echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" > /etc/apt/sources.list \
&& echo "deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib" >> /etc/apt/sources.list
- 安裝php71-redis擴(kuò)展
pecl install -o -f redis \ && rm -rf /tmp/pear \ && echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini
curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/3.1.6.tar.gz \ && tar xfz /tmp/redis.tar.gz \ && rm -r /tmp/redis.tar.gz \ && mv phpredis-3.1.6 /usr/src/php/ext/redis \ && docker-php-ext-install redis
- 安裝php-igbinary擴(kuò)展
pecl install -o -f igbinary \ && rm -rf /tmp/pear \ && docker-php-ext-enable igbinary
- 安裝pdo_mysql擴(kuò)展
- 官方腳本方式(pdo_mysql依賴(lài)igbinary)
docker-php-ext-install pdo_mysql
- 安裝swoole v1.10.1
docker cp /tmp/v1.10.1.zip 5538061f5c26:/tmp/
unzip /tmp/v1.10.1.zip
phpize
./configure
make && make install
- 完整的Dockerfile
FROM php:7.1-cli
COPY swoole-v1.10.1.tar.gz /tmp/
WORKDIR /usr/src/swoole
RUN buildDeps='unzip wget' \
&& echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" > /etc/apt/sources.list \
&& echo "deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y $buildDeps \
#安裝igbinary擴(kuò)展
&& pecl install -o -f igbinary \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable igbinary \
#安裝redis擴(kuò)展
&& pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
#安裝mysql擴(kuò)展
&& docker-php-ext-install pdo_mysql \
#安裝swoole1.10.1
&& tar -xzf /tmp/swoole-v1.10.1.tar.gz -C /usr/src/swoole --strip-components=1 \
&& phpize \
&& ./configure \
&& make \
&& make install \
&& docker-php-ext-enable swoole \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /tmp/swoole-v1.10.1.tar.gz \
&& rm -r /usr/src/swoole \
&& apt-get purge -y --auto-remove $buildDeps
WORKDIR /
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。