-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
128 lines (116 loc) · 3.4 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
126
127
128
FROM php:7.2-apache
# Enable the Cache Expiration, URL Rewriting and SSL Apache modules.
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
ssl-cert \
; \
\
if command -v a2enmod; then \
a2enmod \
expires \
rewrite \
ssl \
; \
fi; \
\
if command -v a2ensite; then \
a2ensite \
default-ssl \
; \
fi; \
rm -rf /var/lib/apt/lists/*
# Install and configure PHP dependencies and extensions.
RUN set -ex; \
# Save apt-mark's 'manual' list for purging build dependencies.
savedAptMark="$(apt-mark showmanual)"; \
\
# Install build dependencies.
apt-get update; \
apt-get install -y --no-install-recommends \
libjpeg-dev \
libpng-dev \
libpq-dev \
zlib1g-dev \
; \
# Extract the PHP source and configure extensions.
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
# Include the PECL Upload Progress PHP extension source.
# see https://www.drupal.org/project/drupal/issues/2718253
mkdir /usr/src/php/ext/uploadprogress; \
curl -fSL https://github.com/php/pecl-php-uploadprogress/archive/master.tar.gz | tar xvz -C /usr/src/php/ext/uploadprogress --strip 1; \
\
docker-php-ext-install -j "$(nproc)" \
exif \
gd \
mbstring \
mysqli \
opcache \
pdo \
pdo_mysql \
uploadprogress \
zip \
; \
\
# Reset apt-mark's 'manual' list so that 'purge --auto-remove' will remove all
# build dependencies.
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
RUN set -ex; \
{ \
# Set recommended PHP.ini settings.
# See https://secure.php.net/manual/en/opcache.installation.php.
echo 'opcache.memory_consumption = 128'; \
echo 'opcache.interned_strings_buffer = 8'; \
echo 'opcache.max_accelerated_files = 4000'; \
echo 'opcache.revalidate_freq = 60'; \
echo 'opcache.fast_shutdown = 1'; \
echo 'opcache.enable_cli = 1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# Install ImageMagick dependencies and ImageMagick.
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libmagickwand-dev \
imagemagick \
; \
rm -rf /var/lib/apt/lists/*
# Install Drupal Console Launcher, Drush Launcher and dependencies.
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
default-mysql-client \
rsync \
; \
rm -rf /var/lib/apt/lists/*; \
\
curl -OL https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar; \
chmod +x drush.phar; \
mv drush.phar /usr/local/bin/drush; \
\
curl https://drupalconsole.com/installer -L -o drupal.phar; \
mv drupal.phar /usr/local/bin/drupal; \
chmod +x /usr/local/bin/drupal
# Copy the remote file server site include configuration file.
COPY conf/apache2/conf-available/remote-file-server.conf /etc/apache2/conf-available/
# Copy scripts.
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /var/www
EXPOSE 443
CMD ["apache2-foreground"]
HEALTHCHECK --interval=5m --timeout=3s \
CMD drush -r /var/www/html status bootstrap | grep -q Successful