FROM centos:7
#version defined
ENV SWOOLE_VERSION 4.4.12
ENV EASYSWOOLE_VERSION 3.x-dev
#install libs
RUN yum install -y curl zip unzip wget openssl-devel gcc-c++ make autoconf
#install php
RUN yum install -y epel-release
RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
RUN yum clean all
RUN yum update -y
RUN yum install -y php71w-devel php71w-openssl php71w-mbstring
# composer
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/bin/composer
# use aliyun composer
RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
# swoole ext
RUN wget https://github.com/swoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz \
&& mkdir -p swoole \
&& tar -xf swoole.tar.gz -C swoole --strip-components=1 \
&& rm swoole.tar.gz \
&& ( \
cd swoole \
&& phpize \
&& ./configure --enable-openssl \
&& make \
&& make install \
) \
&& sed -i "2i extension=swoole.so" /etc/php.ini \
&& rm -r swoole
# swoole-async ext
RUN wget https://github.com/swoole/ext-async/archive/v${SWOOLE_VERSION}.tar.gz -O swoole-async.tar.gz \
&& mkdir -p swoole-async \
&& tar -xf swoole-async.tar.gz -C swoole-async --strip-components=1 \
&& rm swoole-async.tar.gz \
&& ( \
cd swoole-async \
&& phpize \
&& ./configure --enable-openssl \
&& make \
&& make install \
) \
&& sed -i "2i extension=swoole_async.so" /etc/php.ini \
&& rm -r swoole-async
# Dir
WORKDIR /easyswoole
# install easyswoole
RUN cd /easyswoole \
&& composer require easyswoole/easyswoole=${EASYSWOOLE_VERSION} \
&& php vendor/bin/easyswoole install
EXPOSE 9501
EXPOSE 9600
EXPOSE 8500
EXPOSE 8080