Skip to content

fix(build): stabilize NodeSource Node 22 install in Docker image#91

Merged
techartdev merged 3 commits intomainfrom
fix/issue-89-nodesource-install-stability
Mar 7, 2026
Merged

fix(build): stabilize NodeSource Node 22 install in Docker image#91
techartdev merged 3 commits intomainfrom
fix/issue-89-nodesource-install-stability

Conversation

@techartdev
Copy link
Owner

Summary

Fixes intermittent Docker build failures (exit code 100) during Node.js installation by replacing the legacy NodeSource setup_22.x | bash flow with explicit keyring + apt source configuration.

Changes

  • openclaw_assistant/Dockerfile
    • removed pipe-script installer (curl ... setup_22.x | bash)
    • added deterministic NodeSource keyring + sources.list.d repo setup
    • install Node.js 22 via apt-get install --no-install-recommends nodejs
  • openclaw_assistant/CHANGELOG.md
    • documented build stability fix under Unreleased
  • openclaw_assistant/config.yaml
    • bumped add-on version to 0.5.57

Why this happened

The setup script path can fail/intermittently leave apt without a usable NodeSource source in container builds, causing apt-get install nodejs to fail with exit code 100.

Validation

  • Build step updated to explicit apt keyring/source flow
  • Existing install chain remains unchanged after Node install

Fixes #89

- replace NodeSource setup_22.x pipe script with keyring + apt source
- prevent intermittent apt exit 100 during nodejs install
- bump add-on version to 0.5.57

Fixes #89
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Stabilizes the Home Assistant add-on Docker image build by replacing the deprecated/intermittent NodeSource setup_22.x | bash install flow with an explicit apt keyring + repository configuration for installing Node.js 22.

Changes:

  • Replaced the NodeSource pipe-to-bash installer with a deterministic keyring + sources.list.d repo setup in the Dockerfile.
  • Documented the Docker build stability fix in the changelog under Unreleased.
  • Bumped the add-on version to 0.5.57.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
openclaw_assistant/Dockerfile Switches Node.js installation to explicit NodeSource keyring + apt source configuration to reduce build flakiness.
openclaw_assistant/CHANGELOG.md Adds an Unreleased “Fixed” entry describing the build stability change.
openclaw_assistant/config.yaml Updates add-on version to reflect the release containing the Docker build fix.

# Use explicit keyring + apt source instead of setup_22.x pipe script for deterministic builds.
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg output is commonly created with restrictive permissions; if the file is not world-readable, apt-get update can fail under the _apt sandbox user when verifying the repo. Consider explicitly setting readable permissions (e.g., chmod 644 /etc/apt/keyrings/nodesource.gpg) after writing the keyring to make the build more reliable across base images/apt configs.

Suggested change
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& chmod 644 /etc/apt/keyrings/nodesource.gpg \

Copilot uses AI. Check for mistakes.
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" \
> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends nodejs \
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the NodeSource repo setup fails for any reason, apt-get install nodejs may still succeed by installing Debian’s default nodejs package (Bookworm ships Node 18), which would silently violate the “20+ required” constraint. To keep builds deterministic, consider asserting the installed major version (e.g., fail unless node -v is v22.x) as part of this install step.

Suggested change
&& apt-get install -y --no-install-recommends nodejs \
&& apt-get install -y --no-install-recommends nodejs \
&& node -v \
&& node -v | grep -E '^v22\.' \

Copilot uses AI. Check for mistakes.
- ensure nodesource keyring is world-readable for _apt
- assert installed Node major is v22 to avoid Debian Node 18 fallback
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

&& apt-get update \
&& apt-get install -y --no-install-recommends nodejs \
&& node -v \
&& node -v | grep -E '^v22\.' \
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NodeSource repo is added to the image and left enabled. Since the Dockerfile later runs another apt-get update (for Chromium), build stability can still be impacted if deb.nodesource.com is temporarily unavailable at that later step. Consider removing /etc/apt/sources.list.d/nodesource.list (and optionally the keyring) right after installing nodejs so subsequent apt-get update calls only hit Debian mirrors.

Suggested change
&& node -v | grep -E '^v22\.' \
&& node -v | grep -E '^v22\.' \
&& rm -f /etc/apt/sources.list.d/nodesource.list /etc/apt/keyrings/nodesource.gpg \

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +47
&& node -v \
&& node -v | grep -E '^v22\.' \
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node -v is executed twice in a row (once for logging and once for the version assertion). Consider capturing the version once (or piping the first output) to avoid redundant work and keep the install step simpler.

Suggested change
&& node -v \
&& node -v | grep -E '^v22\.' \
&& NODE_VERSION="$(node -v)" \
&& echo "${NODE_VERSION}" \
&& echo "${NODE_VERSION}" | grep -E '^v22\.' \

Copilot uses AI. Check for mistakes.
- remove NodeSource repo/key after Node install
- avoid duplicate node -v call via NODE_VERSION variable
@techartdev techartdev merged commit 04ffef8 into main Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: NodeSource setup_22.x install fails during Docker build (exit code 100)

2 participants