forked from jetsung/docker-nginx-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
157 lines (136 loc) · 3.83 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
FROM centos:7
MAINTAINER Skiychan <[email protected]>
ENV NGINX_VERSION 1.11.6
ENV PHP_VERSION 7.1.0
RUN set -x && \
yum install -y gcc \
gcc-c++ \
autoconf \
automake \
libtool \
make \
cmake && \
#Install PHP library
## libmcrypt-devel DIY
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \
yum install -y zlib \
zlib-devel \
openssl \
openssl-devel \
pcre-devel \
libxml2 \
libxml2-devel \
libcurl \
libcurl-devel \
libpng-devel \
libjpeg-devel \
freetype-devel \
libmcrypt-devel \
openssh-server \
python-setuptools && \
#Add user
mkdir -p /data/{www,phpext} && \
useradd -r -s /sbin/nologin -d /data/www -m -k no www && \
#Download nginx & php
mkdir -p /home/nginx-php && cd $_ && \
curl -Lk http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | gunzip | tar x -C /home/nginx-php && \
curl -Lk http://php.net/distributions/php-$PHP_VERSION.tar.gz | gunzip | tar x -C /home/nginx-php && \
#Make install nginx
cd /home/nginx-php/nginx-$NGINX_VERSION && \
./configure --prefix=/usr/local/nginx \
--user=www --group=www \
--error-log-path=/var/log/nginx_error.log \
--http-log-path=/var/log/nginx_access.log \
--pid-path=/var/run/nginx.pid \
--with-pcre \
--with-http_ssl_module \
--without-mail_pop3_module \
--without-mail_imap_module \
--with-http_gzip_static_module && \
make && make install && \
#Make install php
cd /home/nginx-php/php-$PHP_VERSION && \
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-config-file-scan-dir=/usr/local/php/etc/php.d \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mcrypt=/usr/include \
--with-mysqli \
--with-pdo-mysql \
--with-openssl \
--with-gd \
--with-iconv \
--with-zlib \
--with-gettext \
--with-curl \
--with-png-dir \
--with-jpeg-dir \
--with-freetype-dir \
--with-xmlrpc \
--with-mhash \
--enable-fpm \
--enable-xml \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--enable-mysqlnd \
--enable-pcntl \
--enable-sockets \
--enable-zip \
--enable-soap \
--enable-session \
--enable-opcache \
--enable-bcmath \
--enable-exif \
--enable-fileinfo \
--disable-rpath \
--enable-ipv6 \
--disable-debug \
--without-pear && \
make && make install && \
#Install php-fpm
cd /home/nginx-php/php-$PHP_VERSION && \
cp php.ini-production /usr/local/php/etc/php.ini && \
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf && \
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf && \
#Install supervisor
easy_install supervisor && \
mkdir -p /var/{log/supervisor,run/{sshd,supervisord}} && \
#Clean OS
yum remove -y gcc \
gcc-c++ \
autoconf \
automake \
libtool \
make \
cmake && \
yum clean all && \
rm -rf /tmp/* /var/cache/{yum,ldconfig} /etc/my.cnf{,.d} && \
mkdir -p --mode=0755 /var/cache/{yum,ldconfig} && \
find /var/log -type f -delete && \
rm -rf /home/nginx-php && \
#Change Mod from webdir
chown -R www:www /data/www
#Add supervisord conf
ADD supervisord.conf /etc/
#Create web folder
VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d", "/data/phpext"]
ADD index.php /data/www/
ADD extini/ /usr/local/php/etc/php.d/
ADD extfile/ /data/phpext/
#Update nginx config
ADD nginx.conf /usr/local/nginx/conf/
#Start
ADD start.sh /
RUN chmod +x /start.sh
#Set port
EXPOSE 80 443
#Start it
ENTRYPOINT ["/start.sh"]
#Start web server
#CMD ["/bin/bash", "/start.sh"]