-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
139 lines (124 loc) · 4.11 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Pull base image
FROM daocloud.io/library/centos:latest
MAINTAINER Cdoco <[email protected]>
ENV PHP_VERSION 7.0.14
# Update source
RUN set -x \
&& yum update -y \
&& yum install -y wget gcc gcc-c++ make perl tar libjpeg libpng libjpeg-devel libpng-devel libjpeg-turbo freetype freetype-devel \
libcurl-devel libxml2-devel libjpeg-turbo-devel libXpm-devel libXpm libicu-devel libmcrypt libmcrypt-devel libxslt-devel libxslt openssl openssl-devel bzip2-devel \
&& yum clean all \
&& mkdir -p /data/deps \
&& mkdir -p /data/server \
# Install zlib
&& cd /data/deps \
&& wget http://jaist.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz \
&& tar zxvf zlib-1.2.8.tar.gz \
&& cd zlib-1.2.8 \
&& ./configure --static --prefix=/data/server/libs/zlib \
&& make \
&& make install \
# Install openssl
&& cd /data/deps \
&& wget http://www.openssl.org/source/openssl-0.9.8zb.tar.gz \
&& tar zxvf openssl-0.9.8zb.tar.gz \
&& cd openssl-0.9.8zb \
&& ./config --prefix=/data/server/libs/openssl -L/data/server/libs/zlib/lib -I/data/server/libs/zlib/include threads zlib enable-static-engine\
&& make \
&& make install \
# Install pcre
&& cd /data/deps \
&& wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz \
&& tar zxvf pcre-8.33.tar.gz \
&& cd pcre-8.33 \
&& ./configure --prefix=/data/server/libs/pcre \
&& make \
&& make install \
# Install nginx
&& cd /data/deps \
&& wget http://nginx.org/download/nginx-1.9.9.tar.gz \
&& tar zxvf nginx-1.9.9.tar.gz \
&& cd nginx-1.9.9 \
&& './configure' \
'--prefix=/data/server/nginx' \
'--with-debug' \
'--with-openssl=/data/deps/openssl-0.9.8zb' \
'--with-zlib=/data/deps/zlib-1.2.8' \
'--with-pcre=/data/deps/pcre-8.33' \
'--with-http_stub_status_module' \
'--with-http_gzip_static_module' \
&& make \
&& make install \
# Install libmcrypt
&& cd /data/deps \
&& wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.6.tar.gz \
&& tar zxvf libmcrypt-2.5.6.tar.gz \
&& cd libmcrypt-2.5.6 \
&& ./configure \
&& make \
&& make install \
# Install php
&& cd /data/deps \
&& wget http://cn2.php.net/distributions/php-$PHP_VERSION.tar.gz \
&& tar zxvf php-$PHP_VERSION.tar.gz \
&& cd php-$PHP_VERSION \
&& './configure' \
'--prefix=/data/server/php/' \
'--with-config-file-path=/data/server/php/etc/' \
'--with-config-file-scan-dir=/data/server/php/conf.d/' \
'--enable-fpm' \
'--enable-cgi' \
'--disable-phpdbg' \
'--enable-mbstring' \
'--enable-calendar' \
'--with-xsl' \
'--with-openssl' \
'--enable-soap' \
'--enable-zip' \
'--enable-shmop' \
'--enable-sockets' \
'--with-gd' \
'--with-jpeg-dir' \
'--with-png-dir' \
'--with-xpm-dir' \
'--with-xmlrpc' \
'--enable-pcntl' \
'--enable-intl' \
'--with-mcrypt' \
'--enable-sysvsem' \
'--enable-sysvshm' \
'--enable-sysvmsg' \
'--enable-opcache' \
'--with-iconv' \
'--with-bz2' \
'--with-curl' \
'--enable-mysqlnd' \
'--with-mysqli=mysqlnd' \
'--with-pdo-mysql=mysqlnd' \
'--with-zlib' \
'--with-gettext=' \
&& make \
&& make install \
# delete data dir
&& yum remove -y gcc* make* \
&& rm -rf /data/deps \
# cp php conf
ADD files/php/php.ini /data/server/php/etc/php.ini
ADD files/php/php-fpm.conf /data/server/php/etc/php-fpm.conf
ADD files/php/www.conf /data/server/php/etc/php-fpm.d/www.conf
# add nginx conf
ADD files/nginx/nginx.conf /data/server/nginx/conf/nginx.conf
ADD files/nginx/default.conf /data/server/nginx/conf/vhost/default.conf
RUN set -x \
&& mkdir -p /data/logs/nginx \
&& touch /data/logs/nginx/access.log
# add run.sh
ADD files/run.sh /data/run.sh
RUN set -x \
&& chmod u+x /data/run.sh
RUN set -x \
&& mkdir -p /data/www \
&& echo "<?php phpinfo();?>" > /data/www/index.php
# Start php-fpm And nginx
CMD ["/data/run.sh"]
EXPOSE 80