Commit 1c483d5c authored by Michael Iseard's avatar Michael Iseard
Browse files

Rebase on official wordpress image

parent 5e5a5496
......@@ -2,7 +2,6 @@
HOST=sub.domain.com
CONTAINER_PREFIX=mywebsite
PHP_VERSION=7.4
WORDPRESS_VERSION=latest
# wordpress - wordpress:php7.3-fpm
WORDPRESS_DB_NAME=kudos
......@@ -13,7 +12,7 @@ ADMINER_HOST=adminer.domain.com
ADMINER_PORT=8082
ADMINER_TRAEFIK_ENABLE=true
# mariadb - mariadb:latest
# db - mariadb:latest
MARIADB_VERSION=latest
MYSQL_ROOT_PASSWORD=changeme
MYSQL_USER=user
......@@ -24,7 +23,7 @@ MYSQL_DATABASE=wordpress
NGINX_VERSION=latest
NGINX_TRAEFIK_ENABLE=true
# redis
# redis - redis:alpine
REDIS_PASSWORD=changeme
# volumes on host
......
......@@ -3,77 +3,15 @@
ARG PHP_VERSION
ARG WORDPRESS_VERSION
FROM php:${PHP_VERSION}-fpm-alpine
# persistent dependencies
RUN apk add --no-cache \
bash \
sed \
ghostscript \
imagemagick \
# image optimization
optipng \
libjpeg-turbo-utils \
gifsicle
FROM wordpress:php${PHP_VERSION}-fpm-alpine
# install the PHP extensions we need
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
freetype-dev \
imagemagick-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev \
; \
\
docker-php-ext-configure gd --with-freetype --with-jpeg; \
docker-php-ext-install -j "$(nproc)" \
bcmath \
exif \
gd \
mysqli \
zip \
; \
pecl install redis imagick; \
docker-php-ext-enable redis imagick; \
\
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 set -eux; \
docker-php-ext-enable opcache; \
{ \
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'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging
RUN { \
# https://www.php.net/manual/en/errorfunc.constants.php
# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
apk add --no-cache --virtual \
.build-deps \
$PHPIZE_DEPS; \
pecl install redis; \
docker-php-ext-enable redis;
# allow larger uploads
RUN { \
......@@ -86,29 +24,4 @@ RUN { \
VOLUME /var/www/html
COPY docker-entrypoint.sh /entrypoint.sh
RUN set ex; \
curl -o wordpress.tar.gz -fSL "https://wordpress.org/latest.tar.gz"; \
# echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -; \
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
tar -xzf wordpress.tar.gz -C /usr/src/; \
rm wordpress.tar.gz; \
chown -R www-data:www-data /usr/src/wordpress; \
# install redis object cache
curl -o /usr/src/wordpress/wp-content/object-cache.php https://raw.githubusercontent.com/pantheon-systems/wp-redis/master/object-cache.php; \
# pre-create wp-content (and single-level children) for folks who want to bind-mount themes, etc so permissions are pre-created properly instead of root:root
mkdir wp-content; \
for dir in /usr/src/wordpress/wp-content/*/; do \
dir="$(basename "${dir%/}")"; \
mkdir "wp-content/$dir"; \
done; \
chown -R www-data:www-data wp-content; \
chmod -R 777 wp-content;
COPY docker-entrypoint.sh /usr/local/bin/
USER 33:33
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php-fpm"]
......@@ -88,7 +88,6 @@ services:
- traefik.http.routers.${CONTAINER_PREFIX}-adminer.tls.certresolver=cloudflare
- traefik.http.routers.${CONTAINER_PREFIX}-adminer.entrypoints=web-secure
redis:
image: redis:alpine
container_name: ${CONTAINER_PREFIX}-redis
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment