-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
73 lines (68 loc) · 2.41 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
FROM php:7.1.11-fpm-alpine
MAINTAINER Oleg Kulik <[email protected]>
RUN apk add --no-cache --virtual .build-deps \
# for all
zlib-dev \
# dev deps for gd
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
# for intl
icu-dev \
# for mcrypt
libmcrypt-dev \
# for soap
libxml2-dev \
# for xsl
libxslt-dev \
# for ldap
openldap-dev \
# to build xdebug from PECL
$PHPIZE_DEPS \
&& pecl install xdebug \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install \
bcmath \
gd \
intl \
ldap \
mbstring \
mcrypt \
mysqli \
opcache \
pdo_mysql \
soap \
xsl \
zip \
# next will add runtime deps for php extensions
# what this does is checks the necessary packages for php extensions Shared Objects
# and adds those (won't be removed when .build-deps are)
&& runDeps="$( \
scanelf --needed --nobanner --recursive \
/usr/local/lib/php/extensions \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .phpexts-rundeps $runDeps \
&& apk del .build-deps
# modify www-data user to have id 1000
RUN apk add \
--no-cache \
--repository http://dl-3.alpinelinux.org/alpine/edge/community/ --allow-untrusted \
--virtual .shadow-deps \
shadow \
&& usermod -u 1000 www-data \
&& groupmod -g 1000 www-data \
&& apk del .shadow-deps \
# Install composer
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "copy('https://composer.github.io/installer.sig', 'signature');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('signature'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& php -r "unlink('composer-setup.php');"
COPY docker-php-entrypoint /usr/local/bin/
VOLUME /srv/www
WORKDIR /srv/www
CMD ["php-fpm"]