forked from swoft-cloud/swoft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
66 lines (60 loc) · 1.76 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
FROM php:7.1
LABEL maintainer="inhere <[email protected]>" version="2.0"
# Version
ENV PHPREDIS_VERSION=4.3.0 \
SWOOLE_VERSION=4.3.5
ADD . /var/www/swoft
# Timezone
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo 'Asia/Shanghai' > /etc/timezone \
# Libs
&& 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 \
# Install composer
&& curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& composer self-update --clean-backups \
# Some php extension
&& docker-php-ext-install pdo_mysql \
bcmath \
sockets \
zip \
sysvmsg \
sysvsem \
sysvshm \
# Redis extension
&& 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
&& 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-mysqlnd --enable-sockets --enable-openssl --enable-http2 \
&& make -j$(nproc) \
&& make install \
) \
&& rm -r swoole \
&& docker-php-ext-enable swoole \
# Install composer deps
&& cd /var/www/swoft \
&& composer install \
&& composer clearcache
WORKDIR /var/www/swoft
EXPOSE 18306 18307 18308
ENTRYPOINT ["php", "/var/www/swoft/bin/swoft", "http:start"]