mirror of
https://github.com/luzifer-docker/wordpress.git
synced 2024-11-09 13:20:02 +00:00
Initial version
This commit is contained in:
commit
bf162982c2
6 changed files with 76 additions and 0 deletions
7
Dockerfile
Normal file
7
Dockerfile
Normal 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
|
15
rootfs/etc/cont-init.d/copy-wordpress.sh
Executable file
15
rootfs/etc/cont-init.d/copy-wordpress.sh
Executable 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
|
6
rootfs/etc/php7/conf.d/10_opcache-recommended.ini
Normal file
6
rootfs/etc/php7/conf.d/10_opcache-recommended.ini
Normal 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
|
9
rootfs/etc/php7/conf.d/error-logging.ini
Normal file
9
rootfs/etc/php7/conf.d/error-logging.ini
Normal 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
|
27
rootfs/usr/local/bin/container-setup
Executable file
27
rootfs/usr/local/bin/container-setup
Executable 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
12
update.sh
Executable 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
|
Loading…
Reference in a new issue