mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-20 14:30:57 +00:00
fix(ci): cache node in install smoke image
This commit is contained in:
@@ -21,6 +21,15 @@ RUN --mount=type=cache,id=openclaw-install-sh-nonroot-apt-cache,target=/var/cach
|
||||
python3 \
|
||||
sudo
|
||||
|
||||
# Preinstall the supported Node runtime in a cacheable build layer so the
|
||||
# non-root smoke covers user-local npm prefixing and missing git without paying
|
||||
# the full NodeSource bootstrap cost on every container run.
|
||||
RUN --mount=type=cache,id=openclaw-install-sh-nonroot-apt-cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,id=openclaw-install-sh-nonroot-apt-lists,target=/var/lib/apt,sharing=locked \
|
||||
set -eux; \
|
||||
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -; \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends nodejs
|
||||
|
||||
RUN useradd -m -s /bin/bash app \
|
||||
&& echo "app ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/app
|
||||
|
||||
|
||||
@@ -15,6 +15,19 @@ if command -v git >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "==> Pre-flight: ensure supported Node is already present"
|
||||
node -e '
|
||||
const version = process.versions.node.split(".").map(Number);
|
||||
const ok =
|
||||
version.length >= 2 &&
|
||||
(version[0] > 22 || (version[0] === 22 && version[1] >= 16));
|
||||
if (!ok) {
|
||||
process.stderr.write(`unsupported node ${process.versions.node}\n`);
|
||||
process.exit(1);
|
||||
}
|
||||
'
|
||||
command -v npm >/dev/null
|
||||
|
||||
echo "==> Run installer (non-root user)"
|
||||
curl -fsSL "$INSTALL_URL" | bash
|
||||
|
||||
|
||||
Reference in New Issue
Block a user