-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
130 lines (110 loc) · 4.86 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
129
130
# https://github.com/docker-library/drupal/blob/master/10.4/php8.3/fpm-alpine3.21/Dockerfile
FROM drupal:10.4.0-rc1-php8.3-fpm-alpine3.21
ARG SSH_PRIVATE_KEY
ARG GIT_USERNAME
ARG GIT_PASSWORD
RUN apk --no-cache add fcgi \
&& curl -sSL -o /usr/local/bin/php-fpm-healthcheck \
https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/a2d45de918787f761754b96b94a59f4f6acebc25/php-fpm-healthcheck \
&& echo "53bc616c4a30f029b98bff48fdeb0c4da252cb11e4f86656a8222a67dc4e5009 /usr/local/bin/php-fpm-healthcheck" | sha256sum -c - \
&& 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 \
mariadb-connector-c \
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
# TLS Enforcement by MariaDB Client in Linux Alpine Base Image
# https://github.com/laravel/framework/discussions/54267
COPY docker/conf/my.cnf /etc/my.cnf.d/my.cnf
COPY docker/conf/drush.yml ~/.drush/drush.yml
# 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 6.1.0
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.5.8
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();'