Skip to content

Commit 59e56d5

Browse files
committed
add initial Dockerfile
1 parent e307387 commit 59e56d5

1 file changed

Lines changed: 114 additions & 0 deletions

File tree

Dockerfile

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
FROM php:7.4-fpm-buster
2+
3+
# install the PHP extensions we need
4+
RUN set -eux; \
5+
\
6+
savedAptMark="$(apt-mark showmanual)"; \
7+
\
8+
apt-get update; \
9+
apt-get install -y --no-install-recommends \
10+
libfreetype6-dev \
11+
libjpeg-dev \
12+
libpng-dev \
13+
libwebp-dev \
14+
libpq-dev \
15+
libzip-dev \
16+
jpegoptim \
17+
optipng \
18+
pngcrush \
19+
pngquant \
20+
libjpeg-progs \
21+
; \
22+
\
23+
docker-php-ext-configure gd \
24+
--with-freetype \
25+
--with-jpeg \
26+
--with-webp \
27+
; \
28+
\
29+
docker-php-ext-install -j "$(nproc)" \
30+
gd \
31+
opcache \
32+
pdo_mysql \
33+
pdo_pgsql \
34+
zip \
35+
; \
36+
\
37+
pecl install redis-5.1.1; \
38+
docker-php-ext-enable redis; \
39+
\
40+
pecl install apcu; \
41+
docker-php-ext-enable apcu; \
42+
\
43+
pecl clear-cache \
44+
\
45+
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
46+
apt-mark auto '.*' > /dev/null; \
47+
apt-mark manual $savedAptMark; \
48+
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
49+
| awk '/=>/ { print $3 }' \
50+
| sort -u \
51+
| xargs -r dpkg-query -S \
52+
| cut -d: -f1 \
53+
| sort -u \
54+
| xargs -rt apt-mark manual; \
55+
\
56+
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
57+
rm -rf /var/lib/apt/lists/*
58+
59+
RUN apt-get update \
60+
&& apt-get install -y --no-install-recommends \
61+
sudo \
62+
rsync \
63+
mariadb-client \
64+
unzip \
65+
git \
66+
imagemagick \
67+
graphicsmagick \
68+
pngquant \
69+
optipng \
70+
jpegoptim \
71+
gifsicle \
72+
libjpeg-turbo-progs \
73+
&& echo "www-data:www-data" | chpasswd \
74+
&& adduser www-data sudo \
75+
&& rm -rf /var/lib/apt/lists/*
76+
77+
# Use the default production configuration
78+
# Do do that now, and find out, why $_ENV is missing with that.
79+
# RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
80+
81+
# Override and set recommended php.ini settings
82+
# see https://secure.php.net/manual/en/opcache.installation.php
83+
RUN { \
84+
echo 'opcache.memory_consumption=128'; \
85+
echo 'opcache.interned_strings_buffer=8'; \
86+
echo 'opcache.max_accelerated_files=4000'; \
87+
echo 'opcache.revalidate_freq=60'; \
88+
echo 'opcache.fast_shutdown=1'; \
89+
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
90+
91+
# Override default settings, to get it running with Drupal smoothly.
92+
RUN { \
93+
echo 'upload_max_filesize = 20M'; \
94+
echo 'post_max_size = 20M'; \
95+
echo 'memory_limit = 256M'; \
96+
} > /usr/local/etc/php/conf.d/custom-settings.ini
97+
98+
# Disable access.log on php-fpm level in docker logs
99+
RUN sed -i s'/access.log = \/proc\/self\/fd\/2/access.log = \/proc\/self\/fd\/1/' /usr/local/etc/php-fpm.d/docker.conf
100+
101+
# Install drush launcher to use the drush version of the project.
102+
ARG DRUSH_LAUNCHER_VERSION=0.6.0
103+
104+
# Install drush launcher with the phar file.
105+
RUN curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush-launcher/releases/download/$DRUSH_LAUNCHER_VERSION/drush.phar" && \
106+
chmod +x /usr/local/bin/drush
107+
108+
# Set the path variable to use drush directly from this project.
109+
ENV PATH="/var/www/html/web/vendor/bin:${PATH}"
110+
111+
# Install Composer
112+
COPY --from=composer:2.3.10 /usr/bin/composer /usr/bin/composer
113+
RUN composer --version
114+

0 commit comments

Comments
 (0)