Add multiarch support and GitHub actions. Support even older versions with newest features

This commit is contained in:
xZero707
2021-09-22 23:46:14 +02:00
parent 566ec70c87
commit 827f27fb7f
12 changed files with 101 additions and 8 deletions

View File

@@ -21,4 +21,4 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build image
run: build/bin/build 5.8.0
run: build/bin/build "5.4.2 5.5.1 5.5.3 5.6.0 5.6.1 5.7.0 5.8.0"

View File

@@ -1,6 +1,7 @@
ARG PHP_VERSION=7.4
ARG WP_VERSION=5.8.0
FROM --platform=${TARGETPLATFORM} wordpress:${WP_VERSION}-php${PHP_VERSION}-fpm-alpine AS wordpress-builder
# As long as new version doesn't require changes to Dockerfile, we don't need separate files
USER root
@@ -54,5 +55,6 @@ ENV ENFORCE_DISABLE_WP_UPDATES true
ENV WP_CLI_DISABLE_AUTO_CHECK_UPDATE true
COPY ["wp-config.php", "/var/www/html"]
COPY ["patches/${WP_VERSION}/wp-admin-update-core.patch", "/etc/wp-mods/wp-admin/update-core.php.patch"]
EXPOSE 80/TCP

View File

@@ -1,11 +1,18 @@
#!/usr/bin/env sh
WP_VERSION="${1:-}"
WP_VERSIONS=${1:-""}
if [ -z "${WP_VERSION}" ]; then
echo "Error: WP_VERSION is null"
if [ -z "${WP_VERSIONS}" ]; then
echo "Error: WP_VERSIONS is null"
exit 1
fi
docker buildx create --use --name build --node build --driver-opt network=host
docker buildx build --pull --push --platform "linux/amd64,linux/armhf,linux/aarch64" --build-arg "WP_VERSION=${WP_VERSION}" --tag "nlss/wordpress:${WP_VERSION}" --tag "nlss/wordpress:latest" .
# Loop through requested versions
for TARGET_VERSION in ${WP_VERSIONS}
do
echo "> Building WordPress ${TARGET_VERSION}"
docker buildx build --pull --push --build-arg "WP_VERSION=${TARGET_VERSION}" --platform "linux/amd64,linux/armhf,linux/aarch64" --tag "nlss/wordpress:${TARGET_VERSION}" .
done

View File

@@ -2,7 +2,7 @@
MOD_FILE="mod-update-core.php"
TARGET_FILE="update-core.php"
PATCH_FILE="update-core.php.patch"
PATCH_FILE="wp-admin-update-core.patch"
set -e
cd ./wp-src
@@ -45,7 +45,7 @@ sed -i "s/${MOD_FILE}/${TARGET_FILE}/g" "${PATCH_FILE}"
echo "> Patch file created ${PATCH_FILE}"
echo "> Please run: "
echo " cp './wp-src/${PATCH_FILE}' '../../rootfs/etc/wp-mods/wp-admin/'"
echo " cp './wp-src/${PATCH_FILE}' '../../patches/5.x.x/'"
echo ""
echo "> Don't forget to inspect the patch and THEN commit"
echo "> Finished"

View File

@@ -0,0 +1,14 @@
--- update-core.php 2020-10-04 19:03:07.898527934 +0200
+++ update-core-mod.php 2020-10-04 19:04:59.434908923 +0200
@@ -915,6 +915,11 @@
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
}
+ wp_die(
+ __( 'Sorry, you are not allowed to update this site.' ) .
+ ' Click <a href="https://github.com/N0rthernL1ghts/wordpress/wiki/WordPress-Core-Updates">here</a> to learn why.'
+ );
+
check_admin_referer( 'upgrade-translations' );
require_once ABSPATH . 'wp-admin/admin-header.php';

View File

@@ -0,0 +1,14 @@
--- update-core.php 2020-10-04 19:51:51.874573636 +0200
+++ update-core-mod.php 2020-10-04 19:53:36.705858923 +0200
@@ -917,6 +917,11 @@
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
}
+ wp_die(
+ __( 'Sorry, you are not allowed to update this site.' ) .
+ ' Click <a href="https://github.com/N0rthernL1ghts/wordpress/wiki/WordPress-Core-Updates">here</a> to learn why.'
+ );
+
check_admin_referer( 'upgrade-core' );
// Do the (un)dismiss actions before headers, so that they can redirect.

View File

@@ -0,0 +1,14 @@
--- update-core.php 2020-10-04 19:51:51.874573636 +0200
+++ update-core.php 2020-10-04 19:53:36.705858923 +0200
@@ -917,6 +917,11 @@
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
}
+ wp_die(
+ __( 'Sorry, you are not allowed to update this site.' ) .
+ ' Click <a href="https://github.com/N0rthernL1ghts/wordpress/wiki/WordPress-Core-Updates">here</a> to learn why.'
+ );
+
check_admin_referer( 'upgrade-core' );
// Do the (un)dismiss actions before headers, so that they can redirect.

View File

@@ -0,0 +1,14 @@
--- update-core.php 2021-01-11 20:24:28.531750881 +0100
+++ update-core.php 2021-01-11 20:27:11.200903166 +0100
@@ -1049,6 +1049,11 @@
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
}
+ wp_die(
+ __( 'Sorry, you are not allowed to update this site.' ) .
+ ' Click <a href="https://github.com/N0rthernL1ghts/wordpress/wiki/WordPress-Core-Updates">here</a> to learn why.'
+ );
+
check_admin_referer( 'upgrade-core' );
// Do the (un)dismiss actions before headers, so that they can redirect.

View File

@@ -0,0 +1,14 @@
--- update-core.php 2021-01-11 20:24:28.531750881 +0100
+++ update-core.php 2021-01-11 20:27:11.200903166 +0100
@@ -1049,6 +1049,11 @@
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
}
+ wp_die(
+ __( 'Sorry, you are not allowed to update this site.' ) .
+ ' Click <a href="https://github.com/N0rthernL1ghts/wordpress/wiki/WordPress-Core-Updates">here</a> to learn why.'
+ );
+
check_admin_referer( 'upgrade-core' );
// Do the (un)dismiss actions before headers, so that they can redirect.

View File

@@ -0,0 +1,14 @@
--- update-core.php 2021-03-19 19:23:29.391214787 +0100
+++ update-core.php 2021-03-19 19:26:23.798962792 +0100
@@ -1050,6 +1050,11 @@
wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
}
+ wp_die(
+ __( 'Sorry, you are not allowed to update this site.' ) .
+ ' Click <a href="https://github.com/N0rthernL1ghts/wordpress/wiki/WordPress-Core-Updates">here</a> to learn why.'
+ );
+
check_admin_referer( 'upgrade-core' );
// Do the (un)dismiss actions before headers, so that they can redirect.

View File

@@ -12,7 +12,7 @@ WP_VERSION=$(echo "${WP_VERSION}" | sed --expression='s/.0//g');
function disableUpdatesPatch() {
if [ "${DISABLE_WP_UPDATES}" != "false" ]; then
echo "> Disabling WordPress updates..."
patch /var/www/html/wp-admin/update-core.php </etc/wp-mods/wp-admin/update-core.php.patch
patch /var/www/html/wp-admin/update-core.php </etc/wp-mods/wp-admin/wp-admin-update-core.patch
fi
}