-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.jessie
232 lines (208 loc) · 6.58 KB
/
Dockerfile.jessie
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
FROM debian:jessie-slim
MAINTAINER "cytopia" <[email protected]>
ENV PHP_VERSION=5.5.38
ENV PHP_INI_DIR=/usr/local/etc/php
# As this is the Jessie Version already, we can skip custom OpenSSL installation
# PHP 5.5 does not work with OpenSSL version from Debian Stretch (need to pick it from Jessie)
# https://github.com/devilbox/docker-php-fpm-5.3/issues/7
#
# https://manpages.debian.org/jessie/openssl/openssl.1ssl.en.html
# https://www.openssl.org/source/old/1.0.1/
#ENV OPENSSL_VERSION=1.0.1t
ENV PHP_BUILD_DEPS \
autoconf2.13 \
libbison-dev \
libcurl4-openssl-dev \
libfl-dev \
libmhash-dev \
libmysqlclient-dev \
libpcre3-dev \
libreadline6-dev \
librecode-dev \
libsqlite3-dev \
# libssl-dev/oldoldstable 1.0.1t-1
libssl-dev \
libxml2-dev
ENV PHP_RUNTIME_DEPS \
libmhash2 \
libmysqlclient18 \
libpcre3 \
librecode0 \
libsqlite3-0 \
# libssl1.0.0/oldoldstable,now 1.0.1t-1
libssl1.0.0 \
libxml2 \
xz-utils
ENV BUILD_TOOLS \
autoconf \
bison \
bisonc++ \
ca-certificates \
curl \
dpkg-dev \
file \
flex \
g++ \
gcc \
libc-dev \
make \
patch \
pkg-config \
re2c \
xz-utils
ENV BUILD_TOOLS_32 \
g++-multilib \
gcc-multilib
ENV RUNTIME_TOOLS \
ca-certificates \
curl
###
### Fix expiring apt keys
###
RUN set -eux \
&& echo 'Acquire::Check-Valid-Until no;' > /etc/apt/apt.conf.d/99no-check-valid-until \
&& { \
echo "deb [trusted=yes] http://deb.debian.org/debian jessie main"; \
echo "deb [trusted=yes] http://security.debian.org/debian-security jessie/updates main"; \
echo "deb [trusted=yes] http://deb.debian.org/debian jessie-updates main"; \
} > /etc/apt/sources.list
# As this is the Jessie Version already, we can skip custom OpenSSL installation
###
### Build OpenSSL
###
#RUN set -eux \
## Install Dependencies
# && apt-get update \
# && apt-get install -y --no-install-recommends --no-install-suggests \
# ${BUILD_TOOLS} \
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# apt-get install -y --no-install-recommends --no-install-suggests \
# ${BUILD_TOOLS_32}; \
# fi \
## Fetch OpenSSL
# && cd /tmp \
# && mkdir openssl \
# && update-ca-certificates \
# && curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz \
# && curl -sS -k -L --fail "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz.asc" -o openssl.tar.gz.asc \
# && tar -xzf openssl.tar.gz -C openssl --strip-components=1 \
# && cd /tmp/openssl \
## Build OpenSSL
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# setarch i386 ./config -m32; \
# else \
# ./config; \
# fi \
# && make depend \
# && make -j"$(nproc)" \
# && make install \
## Cleanup
# && rm -rf /tmp/* \
## Ensure libs are linked to correct architecture directory
# && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
# && mkdir -p "/usr/local/ssl/lib/${debMultiarch}" \
# && ln -s /usr/local/ssl/lib/* "/usr/local/ssl/lib/${debMultiarch}/" \
## Remove Dependencies
# && if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
# apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
# ${BUILD_TOOLS_32}; \
# fi \
# && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
# ${BUILD_TOOLS} \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/*
###
### Setup PHP directories
###
RUN set -eux \
&& mkdir -p ${PHP_INI_DIR}/conf.d \
&& mkdir -p /usr/src/php
###
### Copy PHP, scripts and patches
###
COPY data/docker-php-source /usr/local/bin/
COPY data/php/php-${PHP_VERSION}.tar.xz /usr/src/php.tar.xz
###
### Build PHP
###
RUN set -eux \
# Install Dependencies
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
${PHP_BUILD_DEPS} \
${BUILD_TOOLS} \
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get install -y --no-install-recommends --no-install-suggests \
${BUILD_TOOLS_32}; \
fi \
# Setup Requirements
&& docker-php-source extract \
&& cd /usr/src/php \
\
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
\
# https://bugs.php.net/bug.php?id=74125
&& if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/${debMultiarch}/curl" /usr/local/include/curl; \
fi \
# Build PHP
&& ./configure \
--with-libdir="/lib/${debMultiarch}/" \
--with-config-file-path="${PHP_INI_DIR}" \
--with-config-file-scan-dir="${PHP_INI_DIR}/conf.d" \
--disable-cgi \
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
--with-openssl-dir=/usr \
\
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
\
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
\
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-openssl \
--with-readline \
--with-recode \
--with-zlib \
&& make -j"$(nproc)" \
&& make install \
# Cleanup
&& make clean \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& docker-php-source delete \
# Remove Dependencies
&& if [ "$(dpkg-architecture --query DEB_HOST_ARCH)" = "i386" ]; then \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${BUILD_TOOLS_32}; \
fi \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false \
${PHP_BUILD_DEPS} \
${BUILD_TOOLS} \
# Install Run-time requirements
&& apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
${PHP_RUNTIME_DEPS} \
${RUNTIME_TOOLS} \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Setup extension dir
&& mkdir -p "$(php -r 'echo ini_get("extension_dir");')"
COPY data/docker-php-* /usr/local/bin/
WORKDIR /var/www/html
COPY data/php-fpm.conf /usr/local/etc/
COPY data/php.ini /usr/local/etc/php/php.ini
EXPOSE 9000
CMD ["php-fpm"]