-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile-drupal
104 lines (87 loc) · 3.29 KB
/
Dockerfile-drupal
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
FROM debian:bullseye-slim as drupal-build
# For php8.1
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install \
curl \
lsb-release
RUN curl -so /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg \
&& sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
# Install needed packages
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install \
git \
unzip \
sudo \
procps \
php8.1-apcu \
php8.1-uploadprogress \
php8.1-fpm \
php8.1-xml \
php8.1-mbstring \
php8.1-mysqli \
php8.1-pgsql \
php8.1-gd \
php8.1-curl \
php8.1-zip \
default-mysql-client \
libmemcached11 \
libmemcachedutil2 \
libmemcached-dev \
php-pear \
php-dev \
gnupg2 \
zlib1g-dev \
apt-transport-https \
ca-certificates \
software-properties-common \
libxml2-dev \
libcurl4-openssl-dev \
libmagickwand-dev \
libonig-dev \
libzip-dev \
rsync \
libwebp-dev \
libjpeg62-turbo-dev \
libpng-dev \
libxpm-dev \
libfreetype6-dev \
&& apt-get clean all
RUN update-alternatives --set php /usr/bin/php8.1
RUN pecl channel-update pecl.php.net \
&& pecl install memcached
# Download and install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Download and install security checker
ENV PHP_CHECKER_VERSION=1.0.0
RUN curl -o /tmp/security_checker -L "https://github.com/fabpot/local-php-security-checker/releases/download/v${PHP_CHECKER_VERSION}/local-php-security-checker_${PHP_CHECKER_VERSION}_linux_amd64" \
&& mv /tmp/security_checker /usr/bin/local-php-security-checker \
&& chmod +x /usr/bin/local-php-security-checker
# create Drupal folders
RUN mkdir -p /drupal/web/sites/default/files \
&& mkdir -p /drupal/data/default/private \
&& mkdir -p /drupal/data/default/temp \
&& mkdir -p /drupal/config/default \
&& usermod -d /drupal www-data \
&& chown -hR www-data:www-data /drupal
RUN update-rc.d php8.1-fpm disable
COPY --chown=www-data:www-data ./ /drupal
COPY scripts/. /scripts
WORKDIR /drupal
RUN sed -i 's;listen = /run/php/php8.1-fpm.sock;listen = 9000;' /etc/php/8.1/fpm/pool.d/www.conf
RUN echo "clear_env = no" >> /etc/php/8.1/fpm/pool.d/www.conf
RUN echo "catch_workers_output = yes" >> /etc/php/8.1/fpm/pool.d/www.conf
RUN echo "decorate_workers_output = no" >> /etc/php/8.1/fpm/pool.d/www.conf
RUN echo "php_admin_flag[fastcgi.logging] = off\nphp_admin_flag[log_errors] = on\nphp_admin_value[error_log] = /proc/self/fd/2\n[global]\nerror_log = /proc/self/fd/2" >> /etc/php/8.1/fpm/pool.d/www.conf
RUN echo 'extension="memcached.so"' >> /etc/php/8.1/fpm/conf.d/20-memcached.ini
RUN sed -i 's;expose_php = on;expose_php = off;' /etc/php/8.1/fpm/php.ini && mkdir -p /run/php
RUN sed -i 's;memory_limit = 128M;memory_limit = 384M;' /etc/php/8.1/fpm/php.ini
RUN sed -i 's;upload_max_filesize = 2M;upload_max_filesize = 128M;' /etc/php/8.1/fpm/php.ini
RUN sed -i 's;post_max_size = 8M;post_max_size = 128M;' /etc/php/8.1/fpm/php.ini
RUN export HOME=/tmp \
&& sudo -E -u www-data composer install
RUN ln -s /drupal/vendor/drush/drush/drush /usr/bin/drush \
&& chmod 755 /drupal/deploy.sh
EXPOSE 80
CMD php-fpm8.1 -F -R