feat(images): upgrade lsphp from the LiteSpeed repo at build time; label PHP version
cac-litespeed and cac-lsphp start FROM litespeedtech/openlitespeed:1.8.4-lsphpNN, which ships lsphp85 8.5.0 / lsphp84 8.4.15 (built 2025-12). lsphp only moved forward as a side effect of installing lsphpNN-ldap. lsphp-apt-upgrade.sh now sweeps every installed lsphpNN* package (and OS packages) to the repo's current release on every build and fails the build if the repo is unreachable or the result doesn't match what CI resolved from the repo index. CI passes a per-run CACHE_BUST so the upgrade layer is never a cache hit, and images carry org.whp.php-version / org.whp.lsphp-package-version labels. Tested on .148 (2026-10-21): cac-lsphp php85/php84 and cac-litespeed php85 built from this branch report the same PHP (8.5.11 / 8.4.26), identical module lists and OLS 1.8.4 as the current registry images; with the hardening flags each serves/runs PHP as the customer uid, restarts, and stops cleanly (exit 0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
74e12407f8
commit
71ca114529
6 files changed
+242
-10
No files matched your search
@@ -51,6 +51,7 @@ jobs:
|
||||
scripts/ols-htaccess-watcher.sh \
|
||||
scripts/create-vhost-litespeed.sh \
|
||||
scripts/install-lscache-wp.sh \
|
||||
scripts/lsphp-apt-upgrade.sh \
|
||||
scripts/tune-mpm.sh \
|
||||
scripts/tests/lsphp-info-probe.test.sh
|
||||
|
||||
@@ -72,6 +73,14 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# Per-run cache-bust value. Each job's buildx builder is created fresh by
|
||||
# setup-buildx-action (no cache-from/cache-to here), so today nothing is
|
||||
# cached between runs — this keeps it that way if a cache is ever added:
|
||||
# the package-upgrade layers consume CACHE_BUST and can never be reused.
|
||||
- name: Cache-bust value
|
||||
id: bust
|
||||
run: echo "value=$(date -u +%Y%m%dT%H%M%SZ)-${{ gitea.run_id }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -86,6 +95,7 @@ jobs:
|
||||
push: true
|
||||
build-args: |
|
||||
PHPVER=${{ matrix.phpver }}
|
||||
CACHE_BUST=${{ steps.bust.outputs.value }}
|
||||
tags: |
|
||||
repo.anhonesthost.net/cloud-hosting-platform/cac:php${{ matrix.phpver }}
|
||||
${{ matrix.phpver == '85' && 'repo.anhonesthost.net/cloud-hosting-platform/cac:latest' || '' }}
|
||||
@@ -105,6 +115,14 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# Per-run cache-bust value. Each job's buildx builder is created fresh by
|
||||
# setup-buildx-action (no cache-from/cache-to here), so today nothing is
|
||||
# cached between runs — this keeps it that way if a cache is ever added:
|
||||
# the package-upgrade layers consume CACHE_BUST and can never be reused.
|
||||
- name: Cache-bust value
|
||||
id: bust
|
||||
run: echo "value=$(date -u +%Y%m%dT%H%M%SZ)-${{ gitea.run_id }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -120,6 +138,7 @@ jobs:
|
||||
push: true
|
||||
build-args: |
|
||||
PHPVER=${{ matrix.phpver }}
|
||||
CACHE_BUST=${{ steps.bust.outputs.value }}
|
||||
tags: |
|
||||
repo.anhonesthost.net/cloud-hosting-platform/cac-fpm:php${{ matrix.phpver }}
|
||||
${{ matrix.phpver == '85' && 'repo.anhonesthost.net/cloud-hosting-platform/cac-fpm:latest' || '' }}
|
||||
@@ -143,6 +162,29 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# Per-run cache-bust value. Each job's buildx builder is created fresh by
|
||||
# setup-buildx-action (no cache-from/cache-to here), so today nothing is
|
||||
# cached between runs — this keeps it that way if a cache is ever added:
|
||||
# the package-upgrade layers consume CACHE_BUST and can never be reused.
|
||||
- name: Cache-bust value
|
||||
id: bust
|
||||
run: echo "value=$(date -u +%Y%m%dT%H%M%SZ)-${{ gitea.run_id }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Ask the LiteSpeed apt repo (the same one the base image's apt uses) for the
|
||||
# CURRENT lsphp version. The Dockerfile asserts the installed package equals
|
||||
# this (build fails if the repo changed mid-build — just re-run) and writes
|
||||
# it into the image labels org.whp.php-version / org.whp.lsphp-package-version.
|
||||
- name: Resolve current lsphp${{ matrix.phpver }} from the LiteSpeed repo
|
||||
id: lsphp
|
||||
run: |
|
||||
set -euo pipefail
|
||||
idx=$(curl -fsS --retry 3 --max-time 60 http://rpms.litespeedtech.com/debian/dists/noble/main/binary-amd64/Packages)
|
||||
pkg=$(printf '%s\n' "$idx" | awk -v p="lsphp${{ matrix.phpver }}" '/^Package: /{n=$2} /^Version: / && n==p {print $2}' | sort -V | tail -n1)
|
||||
if [ -z "$pkg" ]; then echo "::error::lsphp${{ matrix.phpver }} not found in the LiteSpeed repo index"; exit 1; fi
|
||||
echo "lsphp${{ matrix.phpver }} in repo: $pkg (PHP ${pkg%%-*})"
|
||||
echo "pkg=$pkg" >> "$GITHUB_OUTPUT"
|
||||
echo "php=${pkg%%-*}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -159,6 +201,9 @@ jobs:
|
||||
build-args: |
|
||||
PHPVER=${{ matrix.phpver }}
|
||||
OLS_VERSION=1.8.4
|
||||
CACHE_BUST=${{ steps.bust.outputs.value }}
|
||||
EXPECT_LSPHP_PKG=${{ steps.lsphp.outputs.pkg }}
|
||||
EXPECT_PHP_VERSION=${{ steps.lsphp.outputs.php }}
|
||||
# OLS_VERSION pinned to 1.8.4 — only release with prebuilt images
|
||||
# for every PHP version we ship (1.8.5 and 1.9.0 don't have an
|
||||
# lsphp81 variant on Docker Hub). Bump alongside a local rebuild
|
||||
@@ -187,6 +232,29 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# Per-run cache-bust value. Each job's buildx builder is created fresh by
|
||||
# setup-buildx-action (no cache-from/cache-to here), so today nothing is
|
||||
# cached between runs — this keeps it that way if a cache is ever added:
|
||||
# the package-upgrade layers consume CACHE_BUST and can never be reused.
|
||||
- name: Cache-bust value
|
||||
id: bust
|
||||
run: echo "value=$(date -u +%Y%m%dT%H%M%SZ)-${{ gitea.run_id }}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Ask the LiteSpeed apt repo (the same one the base image's apt uses) for the
|
||||
# CURRENT lsphp version. The Dockerfile asserts the installed package equals
|
||||
# this (build fails if the repo changed mid-build — just re-run) and writes
|
||||
# it into the image labels org.whp.php-version / org.whp.lsphp-package-version.
|
||||
- name: Resolve current lsphp${{ matrix.phpver }} from the LiteSpeed repo
|
||||
id: lsphp
|
||||
run: |
|
||||
set -euo pipefail
|
||||
idx=$(curl -fsS --retry 3 --max-time 60 http://rpms.litespeedtech.com/debian/dists/noble/main/binary-amd64/Packages)
|
||||
pkg=$(printf '%s\n' "$idx" | awk -v p="lsphp${{ matrix.phpver }}" '/^Package: /{n=$2} /^Version: / && n==p {print $2}' | sort -V | tail -n1)
|
||||
if [ -z "$pkg" ]; then echo "::error::lsphp${{ matrix.phpver }} not found in the LiteSpeed repo index"; exit 1; fi
|
||||
echo "lsphp${{ matrix.phpver }} in repo: $pkg (PHP ${pkg%%-*})"
|
||||
echo "pkg=$pkg" >> "$GITHUB_OUTPUT"
|
||||
echo "php=${pkg%%-*}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Login to Gitea
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -203,6 +271,9 @@ jobs:
|
||||
build-args: |
|
||||
PHPVER=${{ matrix.phpver }}
|
||||
OLS_VERSION=1.8.4
|
||||
CACHE_BUST=${{ steps.bust.outputs.value }}
|
||||
EXPECT_LSPHP_PKG=${{ steps.lsphp.outputs.pkg }}
|
||||
EXPECT_PHP_VERSION=${{ steps.lsphp.outputs.php }}
|
||||
# OLS_VERSION pinned to 1.8.4 to match Build-LiteSpeed-Images — same
|
||||
# prebuilt base, same lsphp binaries. Bump both together.
|
||||
tags: |
|
||||
|
||||
Reference in new issue
Block a user