Skip to content

Commit

Permalink
add docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
kiss291323003 committed Jan 23, 2019
1 parent 2893a14 commit a743c5a
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,77 @@ php vendor/bin/easyswoole install
php easyswoole start
```

## DockerFile
```
FROM php:7.2
# Version
ENV PHPREDIS_VERSION 4.0.1
ENV SWOOLE_VERSION 4.2.13
ENV EASYSWOOLE_VERSION 3.x-dev
# Timezone
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' > /etc/timezone
# Libs
RUN apt-get update \
&& apt-get install -y \
curl \
wget \
git \
zip \
libz-dev \
libssl-dev \
libnghttp2-dev \
libpcre3-dev \
&& apt-get clean \
&& apt-get autoremove
# Composer
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& composer self-update --clean-backups
# PDO extension
RUN docker-php-ext-install pdo_mysql
# Bcmath extension
RUN docker-php-ext-install bcmath
# Redis extension
RUN wget http://pecl.php.net/get/redis-${PHPREDIS_VERSION}.tgz -O /tmp/redis.tar.tgz \
&& pecl install /tmp/redis.tar.tgz \
&& rm -rf /tmp/redis.tar.tgz \
&& docker-php-ext-enable redis
# Swoole extension
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-async-redis --enable-mysqlnd --enable-openssl --enable-http2 \
&& make -j$(nproc) \
&& make install \
) \
&& rm -r swoole \
&& docker-php-ext-enable swoole
WORKDIR /var/www/code
# Install easyswoole
RUN cd /var/www/code \
&& composer require easyswoole/easyswoole=${EASYSWOOLE_VERSION} \
&& php vendor/bin/easyswoole install
EXPOSE 9501
ENTRYPOINT ["php", "/var/www/code/easyswoole", "start"]
```

## Others
- [Home Page](https://www.easyswoole.com)
- [Git For Doc](https://github.com/easy-swoole/doc)
Expand Down

0 comments on commit a743c5a

Please sign in to comment.