-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
122 lines (103 loc) · 4.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
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
# https://github.com/docker-library/drupal/blob/master/10.3/php8.3/fpm-alpine3.19/Dockerfile
FROM drupal:10.3-php8.3-fpm-alpine
ARG SSH_PRIVATE_KEY
ARG GIT_USERNAME
ARG GIT_PASSWORD
RUN apk --update add fcgi \
&& curl -o /usr/local/bin/php-fpm-healthcheck https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/master/php-fpm-healthcheck \
&& chmod +x /usr/local/bin/php-fpm-healthcheck
COPY docker/conf/php-fpm/status.conf /usr/local/etc/php-fpm.d/
HEALTHCHECK --interval=5s --timeout=10s --start-period=5s --retries=3 CMD [ "php-fpm-healthcheck" ]
# Install additional extensions
RUN apk --update add --no-cache bash \
git \
gzip \
mysql-client \
patch \
postgresql-client \
ssmtp \
zlib-dev
COPY docker/conf/ssmtp.conf /etc/ssmtp/ssmtp.conf
RUN echo "hostname=drupalwxt.github.io" >> /etc/ssmtp/ssmtp.conf
RUN echo 'sendmail_path = "/usr/sbin/ssmtp -t"' > /usr/local/etc/php/conf.d/mail.ini
COPY docker/conf/php.ini /usr/local/etc/php/php.ini
# Install additional php extensions
RUN apk add --update --no-cache autoconf \
icu \
icu-libs \
libzip-dev \
gcc \
g++ \
make \
libffi-dev \
openssl-dev; \
\
apk add --no-cache --virtual .build-deps icu-dev; \
\
docker-php-ext-configure zip \
--with-zlib-dir=/usr; \
\
docker-php-ext-install -j "$(nproc)" \
bcmath \
intl \
zip; \
\
apk del .build-deps
COPY docker/certs/BaltimoreCyberTrustRoot.crt.pem /etc/ssl/mysql/BaltimoreCyberTrustRoot.crt.pem
# Redis
ENV PHPREDIS_VERSION 5.3.7
RUN mkdir -p /usr/src/php/ext/redis \
&& curl -L https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \
&& echo 'redis' >> /usr/src/php-available-exts \
&& docker-php-ext-install redis
# Composer recommended settings
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_VERSION 2.4.4
ENV COMPOSER_MEMORY_LIMIT -1
ENV COMPOSER_EXIT_ON_PATCH_FAILURE 1
# Check Composer
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer; \
curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig; \
php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }"
# Install Composer
RUN php /tmp/composer-setup.php --no-ansi \
--install-dir=/usr/local/bin \
--filename=composer \
--version=${COMPOSER_VERSION}; \
rm -rf /tmp/composer-setup.php
# Install Drupal WxT
RUN rm -f /var/www/composer.lock; \
rm -rf /root/.composer
RUN rm -rf /var/www/*
COPY scripts/ScriptHandler.php /var/www/scripts/ScriptHandler.php
COPY composer.json composer.lock /var/www/
# Copy possible custom modules and custom themes
COPY html/modules/custom/ /var/www/html/modules/custom/
COPY html/themes/custom/ /var/www/html/themes/custom/
# Copy possible config/sync and other config
COPY config/ /var/www/config/
# Copy possible load.environment.php
COPY load.environment.php /var/www/
# Copy patches directory for local patches.
# Create the directory if it doesn't exist in the build context.
RUN mkdir -p patches
COPY patches/ /var/www/patches/
WORKDIR /var/www
RUN apk --update --no-cache add git openssh-client; \
mkdir -p /root/.ssh; echo $SSH_PRIVATE_KEY | base64 -d > /root/.ssh/id_rsa; \
chmod 700 /root/.ssh; chmod 600 /root/.ssh/id_rsa; \
ssh-keyscan github.com > /root/.ssh/known_hosts; \
composer install --prefer-dist \
--ignore-platform-reqs \
--no-interaction && \
rm -rf /root/.ssh && \
apk del openssh-client
# Permissions
WORKDIR /var/www/html
RUN chown -R www-data:www-data sites/default
# See: https://github.com/docker/docker/issues/9299
RUN echo "export TERM=xterm" >> ~/.bashrc
# Drush
RUN ln -s /var/www/vendor/drush/drush/drush /usr/local/bin/drush
# Reset Cache
RUN php -r 'opcache_reset();'