-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDockerfile
More file actions
83 lines (75 loc) · 2.14 KB
/
Dockerfile
File metadata and controls
83 lines (75 loc) · 2.14 KB
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
FROM php:7.4-apache-bullseye AS drupal-9
# install the PHP extensions we need
RUN set -eux; \
\
if command -v a2enmod; then \
a2enmod rewrite; \
fi; \
\
apt-get update; \
apt-get install -y --no-install-recommends git; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get install -y --no-install-recommends \
libfreetype6-dev \
libjpeg-dev \
libpng-dev \
libpq-dev \
libwebp-dev \
libzip-dev \
; \
\
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg=/usr \
--with-webp \
; \
\
docker-php-ext-install -j "$(nproc)" \
gd \
opcache \
pdo_mysql \
pdo_pgsql \
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 '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
| 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/*
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/
WORKDIR /opt/drupal
COPY ./composer.json composer.json
COPY ./composer.lock composer.lock
COPY ./src src
COPY ./scripts scripts
COPY ./config/drupal-vm.settings.php config/drupal-vm.settings.php
COPY ./config/drupal-vm.services.yml config/drupal-vm.services.yml
RUN set -eux; \
export COMPOSER_HOME="$(mktemp -d)"; \
composer install --no-interaction; \
chown -R www-data:www-data web/sites web/modules web/themes; \
rmdir /var/www/html; \
ln -sf /opt/drupal/web /var/www/html; \
# delete composer cache
rm -rf "$COMPOSER_HOME"
ENV PATH=${PATH}:/opt/drupal/vendor/bin
FROM drupal-9 AS journal-cms