feat: support riscv64 docker and OpenWrt installs (#1551)

This commit is contained in:
Hintay
2026-05-23 03:39:25 +09:00
parent 82c637c36b
commit e5a1d9e70a
5 changed files with 47 additions and 2 deletions
+6 -1
View File
@@ -542,7 +542,7 @@ jobs:
runs-on: ubuntu-latest
needs: [build, build_macos_native]
env:
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/arm/v5
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/arm/v5,linux/riscv64
steps:
- name: Checkout
uses: actions/checkout@v6
@@ -569,6 +569,11 @@ jobs:
- name: Prepare Artifacts
run: chmod +x ./dist/nginx-ui-*/nginx-ui*
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm,arm64,riscv64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v4
+1
View File
@@ -20,6 +20,7 @@ RUN case "${TARGETARCH}/${TARGETVARIANT}" in \
"arm/v7"*) S6_ARCH="arm" ;; \
"arm/v6"*) S6_ARCH="arm" ;; \
"arm/v5"*) S6_ARCH="arm" ;; \
"riscv64/"*) S6_ARCH="riscv64" ;; \
*) echo "Unsupported arch: ${TARGETARCH}/${TARGETVARIANT}" && exit 1 ;; \
esac && \
wget -O /tmp/s6-overlay-noarch.tar.xz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz && \
+1
View File
@@ -21,6 +21,7 @@ RUN case "${TARGETARCH}/${TARGETVARIANT}" in \
"arm/v7"*) S6_ARCH="arm" ;; \
"arm/v6"*) S6_ARCH="arm" ;; \
"arm/v5"*) S6_ARCH="arm" ;; \
"riscv64/"*) S6_ARCH="riscv64" ;; \
*) echo "Unsupported arch: ${TARGETARCH}/${TARGETVARIANT}" && exit 1 ;; \
esac && \
wget -O /tmp/s6-overlay-noarch.tar.xz https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz && \
+3
View File
@@ -209,6 +209,9 @@ identify_the_operating_system_and_architecture() {
'armv8' | 'aarch64')
MACHINE='arm64-v8a'
;;
'riscv64')
MACHINE='riscv64'
;;
*)
echo -e "${FontRed}error: The architecture is not supported by this script.${FontSuffix}"
exit 1
+36 -1
View File
@@ -41,6 +41,41 @@ EOF
assert_contains "$output" "SERVICE_TYPE=openwrt" "OpenWrt 25 should use OpenWrt service type"
}
test_openwrt_with_apk_is_not_detected_as_openrc
test_openwrt_riscv64_is_supported() {
local sandbox output
sandbox="$(mktemp -d)"
trap 'rm -rf "$sandbox"' RETURN
mkdir -p "$sandbox/bin" "$sandbox/etc" "$sandbox/proc/1" "$sandbox/sbin"
cat > "$sandbox/bin/uname" <<'EOF'
#!/usr/bin/env bash
if [[ "${1:-}" == "-m" ]]; then
echo 'riscv64'
else
echo 'Linux'
fi
EOF
chmod +x "$sandbox/bin/uname"
cat > "$sandbox/etc/os-release" <<'EOF'
NAME="OpenWrt"
ID="openwrt"
VERSION_ID="25.10"
EOF
: > "$sandbox/etc/openwrt_release"
: > "$sandbox/proc/cpuinfo"
: > "$sandbox/proc/1/cgroup"
ln -s /bin/true "$sandbox/bin/apk"
output="$(PATH="$sandbox/bin:$PATH" NGINX_UI_INSTALL_TESTING=1 "$INSTALL_SCRIPT" __test_detect "$sandbox" 2>&1)"
assert_contains "$output" "MACHINE=riscv64" "OpenWrt riscv64 should use the linux-riscv64 artifact"
assert_contains "$output" "SERVICE_TYPE=openwrt" "OpenWrt riscv64 should use OpenWrt service type"
}
test_openwrt_with_apk_is_not_detected_as_openrc
echo "ok - install.sh detects OpenWrt 25 apk as openwrt"
test_openwrt_riscv64_is_supported
echo "ok - install.sh detects OpenWrt riscv64 as openwrt"