forked from slawekkolodziej/php-5.3-ioncube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
170 lines (138 loc) · 5.49 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
158
159
160
161
162
163
164
165
166
167
168
169
170
FROM buildpack-deps:jessie
MAINTAINER Steve Lemon <[email protected]>
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
RUN rm -rf /var/www/html \
&& mkdir -p \
/var/www/html \
&& chown -R www-data:www-data \
/var/www/html
#WARN! - bypass pgp veification due to key download error
#RUN gpg --keyserver pgp.mit.edu --recv-keys 0B96609E270F565C13292B24C13C70B87267B52D 0A95E9A026542D53835E3F3A7DEC4E69FC9C83D7
#ENV GPG_KEYS 0B96609E270F565C13292B24C13C70B87267B52D 0A95E9A026542D53835E3F3A7DEC4E69FC9C83D7 0E604491
#RUN set -xe \
# && for key in $GPG_KEYS; do \
# gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
# done
# compile openssl, otherwise --with-openssl won't work
RUN CFLAGS="-fPIC" && OPENSSL_VERSION="1.0.2d" \
&& cd /tmp \
&& mkdir openssl \
&& curl -sL "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz \
&& curl -sL "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz.asc" -o openssl.tar.gz.asc \
# && gpg --verify openssl.tar.gz.asc \
&& tar -xzf openssl.tar.gz -C openssl --strip-components=1 \
&& cd /tmp/openssl \
&& ./config shared && make && make install \
&& rm -rf /tmp/*
ENV PHP_VERSION 5.3.29
ENV PHP_INI_DIR /usr/local/lib
RUN mkdir -p $PHP_INI_DIR/conf.d
# php 5.3 needs older autoconf
RUN set -x \
&& apt-get update && apt-get install -y autoconf2.13 libfreetype6-dev libpng12-dev libpng-dev zlib1g zlib1g-dev php5-mcrypt \
&& rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
&& rm *.deb \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
# && gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
--with-openssl=/usr/local/ssl \
--with-zlib \
--with-zlib-dir=/lib/x86_64-linux-gnu \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--enable-exif \
--disable-hash \
&& make -j"$(nproc)" \
&& make install \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove autoconf2.13 \
&& make clean
# Install tools
RUN apt-get update \
&& apt-get install -y \
nginx \
vim \
exim4-daemon-light \
supervisor \
libjpeg62-turbo-dev \
php5-memcached \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& find /var/log -type f | while read f; do echo -ne '' > $f; done;
COPY docker-php/* /usr/local/bin/
# Install Ioncube
RUN wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
&& tar xvfz ioncube_loaders_lin_x86-64.tar.gz \
&& PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;") \
&& PHP_EXT_DIR=$(php-config --extension-dir) \
&& mkdir -p $PHP_EXT_DIR \
&& cp "ioncube/ioncube_loader_lin_${PHP_VERSION}.so" $PHP_EXT_DIR \
&& cp "ioncube/ioncube_loader_lin_${PHP_VERSION}_ts.so" $PHP_EXT_DIR \
&& rm -rf ioncube ioncube_loaders_lin_x86-64.tar.gz
# Create directory for extensions config files
RUN mkdir -p \
/usr/local/etc/php/conf.d \
/etc/php
# fix: configure: error: freetype.h not found.
RUN mkdir /usr/include/freetype2/freetype
RUN ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h
# Configure extensions
RUN docker-php-ext-configure \
gd \
--with-jpeg-dir=/usr/lib/x86_64-linux-gnu \
--enable-gd-native-ttf \
--with-freetype-dir=/usr/include/freetype2 \
--with-png-dir=/usr/include
RUN docker-php-ext-configure \
hash --with-mhash=/usr
# Install extensions
RUN docker-php-ext-install curl mbstring gd soap calendar xmlrpc xsl hash
# NOTE - workaround to install mcrypt. @190903
COPY lib/libmcrypt-2.5.8.tar.gz /root
RUN cd /root && tar xzf libmcrypt-2.5.8.tar.gz
RUN cd /root/libmcrypt-2.5.8 && ./configure && make && make install
RUN docker-php-ext-install mcrypt
RUN pear channel-discover zenovich.github.io/pear
RUN yes "" | pecl install memcache xdebug-2.2.7 ZendOpcache zenovich/runkit
# Configure PHP
COPY php/php.ini /usr/local/lib
RUN mkdir -p /usr/local/etc/php/conf.d
RUN mv /usr/local/etc/php-fpm.conf.default /etc/php/php-fpm.conf
# Configure exim
COPY exim/set-exim4-update-conf /bin/
RUN chmod a+x /bin/set-exim4-update-conf
# Configure supervisor
COPY supervisor/supervisord-*.conf /etc/supervisor/conf.d/
RUN mkdir -p \
/var/lock/apache2 \
/var/run/apache2 \
/var/log/supervisor
# Configure entrypoints
RUN mkdir -p /entrypointsudo docker attach 665b4a
COPY entrypoint.sh /entrypoint/entrypoint.sh
COPY exim/entrypoint.sh /entrypoint/exim-entrypoint.sh
COPY php/entrypoint.sh /entrypoint/php-entrypoint.sh
# Additional default configurations
COPY nginx/default /etc/nginx/sites-available/default
RUN chmod a+x /entrypoint/*.sh
ENTRYPOINT ["/entrypoint/entrypoint.sh"]
WORKDIR /var/www/html
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord-web.conf"]