-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
83 lines (73 loc) · 2.21 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
FROM php:8.1-apache-buster as dev
ENV WP_VERSION=6.4.3
# persistent dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# Ghostscript is required for rendering PDF previews
ghostscript \
; \
rm -rf /var/lib/apt/lists/*
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libfreetype6-dev \
libicu-dev \
libjpeg-dev \
libmagickwand-dev \
libpng-dev \
libwebp-dev \
libzip-dev \
; \
\
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
; \
docker-php-ext-install -j "$(nproc)" \
bcmath \
exif \
gd \
intl \
mysqli \
zip \
; \
# https://pecl.php.net/package/imagick
pecl install imagick-3.7.0; \
docker-php-ext-enable imagick; \
rm -r /tmp/pear;
# These apache modules are required and not enabled by default in this image
RUN a2enmod rewrite headers xml2enc proxy proxy_fcgi
COPY ./composer.json /var/www/html/composer.json
COPY ./composer.lock /var/www/html/composer.lock
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN composer install
# Get WordPress Files
RUN cd /tmp \
&& apt-get update -y \
&& apt-get install wget -y \
&& apt-get install zip -y \
&& wget http://wordpress.org/wordpress-${WP_VERSION}.zip \
&& unzip wordpress-${WP_VERSION}.zip \
&& rm -rf /tmp/wordpress/wp-content/themes/* \
&& rm -rf /tmp/wordpress/wp-content/plugins/* \
&& cp -avr /tmp/wordpress/* /var/www/html/. \
&& rm -rf /tmp/wordpress /tmp/wordpress-${WP_VERSION}.zip
# So we can update plugins
RUN chown -R www-data:www-data /var/www
RUN find /var/www/ -type d -exec chmod 0755 {} \;
RUN find /var/www/ -type f -exec chmod 644 {} \;
# make the linters executable so we can run them from containers
RUN chmod +x vendor/bin/phpcs
RUN chmod +x vendor/bin/phpcbf
RUN chmod +x vendor/bin/twigcs
FROM dev as prod
COPY dist/themes /var/www/html/wp-content/themes
COPY dist/plugins /var/www/html/wp-content/plugins
COPY wp-config.php /var/www/html/wp-config.php
COPY .htaccess /var/www/html/.htaccess