-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
125 lines (114 loc) · 3.03 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
FROM jsurf/rpi-raspbian:latest
MAINTAINER Wouter De Schuyter <wouter.de.schuyter@gmail.com>
# PHP version
ENV PHP_VERSION 7.0.18
# Other env variables
ENV PHP_INI_DIR /usr/local/etc/php
ENV PHP_SRC_URL https://secure.php.net/get/php-$PHP_VERSION.tar.xz/from/this/mirror
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
ENV PHPIZE_DEPS \
autoconf \
file \
g++ \
gcc \
libc-dev \
make \
pkg-config \
re2c
# Copy over helper binaries
COPY docker-php-* /usr/local/bin/
# Enable cross build
RUN ["cross-build-start"]
# Install deps
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
$PHPIZE_DEPS \
ca-certificates \
curl \
libedit2 \
libsqlite3-0 \
libxml2 \
xz-utils \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*
# Create PHP ini dir
RUN mkdir -p $PHP_INI_DIR/conf.d
# Preparation, download src etc
RUN apt-get update \
&& apt-get install -y --no-install-recommends wget \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/* \
&& mkdir -p /usr/src \
&& cd /usr/src \
&& wget --show-progress -O php.tar.xz $PHP_SRC_URL \
&& apt-get purge -y --auto-remove wget
# Build
RUN set -xe; \
buildDeps=" \
$PHP_EXTRA_BUILD_DEPS \
libcurl4-openssl-dev \
libedit-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
" \
&& apt-get update \
&& apt-get install --no-install-recommends -y $buildDeps \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/* \
&& docker-php-source extract \
&& cd /usr/src/php \
&& ./configure \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
--disable-cgi \
--enable-ftp \
--enable-mbstring \
--enable-mysqlnd \
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
$PHP_EXTRA_CONFIGURE_ARGS \
&& make -j "$(nproc)" \
&& make install \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& make clean \
&& docker-php-source delete \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*
# Configure
RUN set -ex; \
cd /usr/local/etc \
&& { \
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \
cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \
} \
&& { \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
} | tee php-fpm.d/docker.conf \
&& { \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = [::]:9000'; \
} | tee php-fpm.d/zz-docker.conf
# Disable cross build
RUN ["cross-build-end"]
ENTRYPOINT ["docker-php-entrypoint"]
EXPOSE 9000
CMD ["php-fpm"]