-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile-drupal
97 lines (81 loc) · 2.54 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
FROM debian:bullseye-slim as drupal-build
# For php8.1
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install \
curl \
wget \
lsb-release
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list && apt-get update
# 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 \
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
# create volume for shared SSH keys
RUN mkdir -p /drupal/data/default/ssh-keys
VOLUME ["/drupal/data/default/ssh-keys"]
# 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 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 = 512M;' /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