-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.php-fpm
73 lines (63 loc) · 2.43 KB
/
Dockerfile.php-fpm
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.4-fpm-alpine
RUN echo "UTC" > /etc/timezone
# Install PHP modules
RUN set -ex \
&& apk update && apk upgrade\
# Installations into virtual env so they can be deleted afterwards
# (.phpize-deps is standardized by docker-php-ext-install)
&& apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \
&& apk add --no-cache --virtual .build-deps \
make \
# Installations that should be kept
&& apk add --no-cache \
openssl-dev \
freetype-dev \
libpng-dev \
libjpeg-turbo-dev \
libmcrypt-dev \
git \
openssh-client \
curl \
wget \
libbz2 \
libzip-dev \
libxml2-dev \
libtool \
zlib-dev \
bzip2-dev \
icu-dev \
unzip \
oniguruma-dev \
curl-dev \
linux-headers > /dev/null \
&& pecl bundle -d /usr/src/php/ext apcu \
&& docker-php-ext-install -j2 apcu \
&& docker-php-ext-install -j2 bcmath iconv mbstring zip bz2 json pdo pdo_mysql simplexml sockets exif curl \
&& docker-php-ext-enable opcache \
&& rm /usr/src/php/ext/*.tgz \
# Install composer
&& EXPECTED_COMPOSER_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === '${EXPECTED_COMPOSER_SIGNATURE}') { echo 'Composer.phar Installer verified'; } else { echo 'Composer.phar Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --install-dir=/usr/bin --filename=composer \
&& php -r "unlink('composer-setup.php');" \
&& composer --version \
# Remove unnecessary stuff
&& apk del .phpize-deps .build-deps
WORKDIR /var/www/html
# Use the default PHP production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# Custom PHP adjustments (zz to make them the last being applied)
COPY etc/docker/php.ini.local $PHP_INI_DIR/conf.d/zz-usln.ini
# Composer install stuff
COPY composer.* ./
RUN set -ex \
&& composer install --prefer-dist --no-interaction --no-dev -a \
# Delete cache directory to reduce size of image
&& rm -rf ~/.composer/cache
COPY . .
RUN set -ex \
&& composer dump-autoload --no-dev -a
RUN chown -R www-data:www-data ./var/
# fastcgi/php-fpm server available on port 9000, needs extra nginx to be able to serve http
EXPOSE 9000