Initial version

This commit is contained in:
Knut Ahlers 2019-05-11 21:20:19 +02:00
commit bf162982c2
Signed by: luzifer
GPG Key ID: DC2729FDD34BE99E
6 changed files with 76 additions and 0 deletions

7
Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM luzifer/alpine-nginx-php
ENV WP_VERSION=5.2 \
WP_CHECKSUM=2666d749a08b1f863563bc23f87e86adf21e28490762afed0264cad687250bc3
COPY rootfs /
RUN set -ex && /usr/local/bin/container-setup

View File

@ -0,0 +1,15 @@
#!/usr/bin/with-contenv /bin/bash
set -euo pipefail
if [[ -f wp-includes/version.php ]]; then
installed_version=$(grep '^\$wp_version' wp-includes/version.php | sed -E "s/.*'(.*)'.*/\\1/")
if [ -n "${installed_version}" ] && [[ ${installed_version} == ${WP_VERSION} ]]; then
echo "Wordpress installation is up-to-date." >&2
exit 0
fi
fi
echo "No Wordpress installation found or not up-to-date" >&2
echo "Installing bundled Wordpress version" >&2
tar -xvz -C /var/www --strip-components=1 -f /opt/wp.tgz

View File

@ -0,0 +1,6 @@
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=2
opcache.fast_shutdown=1
opcache.enable_cli=1

View File

@ -0,0 +1,9 @@
error_reporting = 4339
display_errors = Off
display_startup_errors = Off
log_errors = On
error_log = /dev/stderr
log_errors_max_len = 1024
ignore_repeated_errors = On
ignore_repeated_source = Off
html_errors = Off

View File

@ -0,0 +1,27 @@
#!/bin/bash
set -euxo pipefail
url="https://github.com/WordPress/WordPress/archive/${WP_VERSION}.tar.gz"
packages=(
php7-gd
php7-mysqli
php7-opcache
php7-zip
)
function cleanup() {
rm -rf \
/tmp/wp.tgz
}
trap cleanup EXIT
function step() {
echo "$@..." >&2
}
step "Downloading wordpress release ${WP_VERSION}"
curl -sSfLo /opt/wp.tgz "${url}"
echo "${WP_CHECKSUM} /opt/wp.tgz" | sha256sum -c
step "Installing required packages"
apk --no-cache add "${packages[@]}"

12
update.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -euxo pipefail
version=$(curl -s "https://lv.luzifer.io/catalog-api/wordpress/latest.txt?p=version")
grep -q "WP_VERSION=${version} " Dockerfile && exit 0 || echo "Update required"
wphash=$(curl -sSfL "https://github.com/WordPress/WordPress/archive/${version}.tar.gz" | sha256sum | cut -d ' ' -f 1)
sed -Ei \
-e "s/WP_VERSION=[0-9.]+/WP_VERSION=${version}/" \
-e "s/WP_CHECKSUM=[a-z0-9]+/WP_CHECKSUM=${wphash}/" \
Dockerfile