mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 11:45:20 +02:00
fix(ci): install Node.js from official tarball instead of NodeSource apt setup
The CI Dockerfile's Node install was failing on ubicloud runners. NodeSource's setup_22.x script runs two internal apt operations that both depend on archive.ubuntu.com + security.ubuntu.com being reachable: 1. apt-get update (to refresh package lists) 2. apt-get install gnupg (as a prerequisite for its gpg keyring) Ubicloud's CI runners frequently can't reach those mirrors — last build hit ~2min of connection timeouts to every security.ubuntu.com IP (185.125.190.82, 91.189.91.83, 91.189.92.24, etc.) plus archive.ubuntu.com mirrors. Compounding this: on Ubuntu 24.04 (noble) "gnupg" was renamed to "gpg" and "gpgconf". NodeSource's setup script still looks for "gnupg", so even when apt works, it fails with "Package 'gnupg' has no installation candidate." The subsequent apt-get install nodejs then fails because the NodeSource repo was never added. Fix: drop NodeSource entirely. Download Node.js v22.20.0 from nodejs.org as a tarball, extract to /usr/local. One host, no apt, no script, no keyring. Before: RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ && apt-get install -y --no-install-recommends nodejs ... After: ENV NODE_VERSION=22.20.0 RUN curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" -o /tmp/node.tar.xz \ && tar -xJ -C /usr/local --strip-components=1 --no-same-owner -f /tmp/node.tar.xz \ && rm -f /tmp/node.tar.xz \ && node --version && npm --version Same installed path (/usr/local/bin/node and npm). Pinned version for reproducibility. Version is bump-visible in the Dockerfile now. Does not address the separate apt flakiness that affects the GitHub CLI install (line 17) or `npx playwright install-deps chromium` (line 33) — those use apt too. If those fail on a future build we can address then. Failing job: build-image (71777913820) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,9 +18,19 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Node.js 22 LTS (needed for claude CLI)
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||
&& apt-get install -y --no-install-recommends nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
# Install from the official nodejs.org tarball instead of NodeSource's apt setup.
|
||||
# NodeSource's setup_22.x script runs its own `apt-get update` + `apt-get install gnupg`,
|
||||
# both of which depend on archive.ubuntu.com / security.ubuntu.com being reachable.
|
||||
# Ubicloud CI runners frequently can't reach those mirrors (connection timeouts),
|
||||
# and "gnupg" was renamed to "gpg" on Ubuntu 24.04 anyway, so NodeSource's script
|
||||
# fails before it can add its own repo. Direct tarball download is network-simpler
|
||||
# (one host: nodejs.org) and doesn't touch apt at all.
|
||||
ENV NODE_VERSION=22.20.0
|
||||
RUN curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" -o /tmp/node.tar.xz \
|
||||
&& tar -xJ -C /usr/local --strip-components=1 --no-same-owner -f /tmp/node.tar.xz \
|
||||
&& rm -f /tmp/node.tar.xz \
|
||||
&& node --version \
|
||||
&& npm --version
|
||||
|
||||
# Bun (install to /usr/local so non-root users can access it)
|
||||
ENV BUN_INSTALL="/usr/local"
|
||||
|
||||
Reference in New Issue
Block a user