forked from docker-library/wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-cli.template
78 lines (69 loc) · 2.3 KB
/
Dockerfile-cli.template
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
FROM php:%%PHP_VERSION%%-alpine
# install the PHP extensions we need
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
libjpeg-turbo-dev \
libpng-dev \
; \
\
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-install gd mysqli opcache; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .wordpress-phpexts-rundeps $runDeps; \
apk del .build-deps
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# install wp-cli dependencies
RUN apk add --no-cache \
less \
mysql-client
RUN set -ex; \
mkdir -p /var/www/html; \
chown -R www-data:www-data /var/www/html
WORKDIR /var/www/html
VOLUME /var/www/html
# pub 2048R/2F6B6B7F 2016-01-07
# Key fingerprint = 3B91 9162 5F3B 1F1B F5DD 3B47 673A 0204 2F6B 6B7F
# uid Daniel Bachhuber <[email protected]>
# sub 2048R/45F9CDE2 2016-01-07
ENV WORDPRESS_CLI_GPG_KEY 3B9191625F3B1F1BF5DD3B47673A02042F6B6B7F
ENV WORDPRESS_CLI_VERSION %%WORDPRESS_CLI_VERSION%%
ENV WORDPRESS_CLI_SHA512 %%WORDPRESS_CLI_SHA512%%
RUN set -ex; \
\
apk add --no-cache --virtual .fetch-deps \
gnupg \
; \
\
curl -o /usr/local/bin/wp.gpg -fSL "https://github.com/wp-cli/wp-cli/releases/download/v${WORDPRESS_CLI_VERSION}/wp-cli-${WORDPRESS_CLI_VERSION}.phar.gpg"; \
\
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$WORDPRESS_CLI_GPG_KEY"; \
gpg --batch --decrypt --output /usr/local/bin/wp /usr/local/bin/wp.gpg; \
rm -rf "$GNUPGHOME" /usr/local/bin/wp.gpg; \
\
echo "$WORDPRESS_CLI_SHA512 */usr/local/bin/wp" | sha512sum -c -; \
chmod +x /usr/local/bin/wp; \
\
apk del .fetch-deps; \
\
wp --allow-root --version
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
USER www-data
CMD ["wp", "shell"]