forked from behance/docker-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-alpine
117 lines (110 loc) · 4.56 KB
/
Dockerfile-alpine
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
FROM behance/docker-nginx:6.2-alpine
MAINTAINER Bryan Latten <[email protected]>
# Set TERM to suppress warning messages.
ENV CONF_PHPFPM=/etc/php7/php-fpm.conf \
CONF_PHPMODS=/etc/php7/conf.d \
CONF_FPMPOOL=/etc/php7/php-fpm.d/www.conf \
CONF_FPMOVERRIDES=/etc/php/7.0/fpm/conf.d/overrides.user.ini \
APP_ROOT=/app \
SERVER_WORKER_CONNECTIONS=3072 \
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
SERVER_CLIENT_HEADER_BUFFER_SIZE=1k \
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
SERVER_LARGE_CLIENT_HEADER_BUFFERS="4 256k" \
PHP_FPM_MAX_CHILDREN=4096 \
PHP_FPM_START_SERVERS=20 \
PHP_FPM_MAX_REQUESTS=1024 \
PHP_FPM_MIN_SPARE_SERVERS=5 \
PHP_FPM_MAX_SPARE_SERVERS=128 \
PHP_FPM_MEMORY_LIMIT=256M \
PHP_FPM_MAX_EXECUTION_TIME=60 \
PHP_FPM_UPLOAD_MAX_FILESIZE=1M \
PHP_OPCACHE_MEMORY_CONSUMPTION=128 \
PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16 \
PHP_OPCACHE_MAX_WASTED_PERCENTAGE=5 \
NEWRELIC_VERSION=6.7.0.174 \
CFG_APP_DEBUG=1
RUN echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \
echo '@community http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
apk update && \
apk add --no-cache \
git \
curl \
wget \
php7@community \
php7-fpm@community \
php7-apcu@edge \
php7-calendar@community \
php7-common@community \
php7-ctype@community \
php7-curl@community \
php7-dom@community \
php7-exif@community \
php7-ftp@community \
php7-gd@community \
php7-gettext@community \
php7-iconv@community \
php7-intl@community \
php7-json@community \
php7-mcrypt@community \
php7-mbstring@community \
php7-msgpack@edge \
# php7-memcached@community \ --- currently only built for arm arch
php7-mysqli@community \
php7-mysqlnd@community \
php7-opcache@community \
php7-openssl@community \
php7-pdo_pgsql@community \
php7-pgsql@community \
php7-pcntl@community \
php7-pdo@community \
php7-pdo_mysql@community \
php7-phar@community \
php7-posix@community \
# php7-readline@community \ --- not currently working on PHP 7
php7-redis@edge \
php7-session@community \
php7-sockets@community \
php7-sysvmsg@community \
php7-sysvsem@community \
php7-sysvshm@community \
php7-shmop@community \
php7-xdebug@edge \
php7-xml@community \
php7-xmlreader@community \
php7-xsl@community \
php7-zip@community \
php7-zlib@community \
&& \
# Alpine + Ubuntu use different versioned names --> now standardized \
ln -s /usr/bin/php7 /usr/bin/php && \
ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm7.0 && \
# Disable xdebug by default \
sed -i 's/zend_extension\s\?=/;zend_extension =/' $CONF_PHPMODS/xdebug.ini && \
# Disable postgres by default \
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/00_pdo_pgsql.ini && \
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/00_pgsql.ini && \
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/20_redis.ini
# Install Alpine-compatible NewRelic, seed with variables to be replaced
# Requires PHP to already be installed
RUN curl -L https://download.newrelic.com/php_agent/archive/${NEWRELIC_VERSION}/newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz -o /root/newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz && \
cd /root && \
gzip -dc newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz | tar xf - && \
rm newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz && \
cd newrelic-php5-${NEWRELIC_VERSION}-linux-musl && \
echo "\n" | ./newrelic-install install && \
chown root:root /root/newrelic-php5-${NEWRELIC_VERSION}-linux-musl/agent/x64/newrelic-20151012.so && \
cp /root/newrelic-php5-${NEWRELIC_VERSION}-linux-musl/agent/x64/newrelic-20151012.so /usr/lib/php7/modules/newrelic.so && \
# Fix permissions on extracted folder \
chown -R $NOT_ROOT_USER:$NOT_ROOT_USER *
RUN curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer
# Overlay the root filesystem from this repo
COPY ./container/root /
# - Make additional hacks to migrate files from Ubuntu to Alpine folder structure
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
rm $CONF_PHPMODS/00_opcache.ini && \
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
/bin/bash -e prep-php.sh
RUN goss -g /tests/php-fpm/alpine.goss.yaml validate && \
/aufs_hack.sh