Container Bootstrap
Prepare a container environment for GitHub Actions before checkout.
This composite action handles three scenarios that arise when running GitHub Actions inside Docker containers:
-
Node.js glibc patching — GitHub Actions ships its own Node.js binary (Node 20 at
/e/node20/bin/node, Node 24 at/e/node24/bin/node), but older containers (e.g., Ubuntu 18.04) have a glibc too old for those binaries. This action detects the failure and replaces the Node 20 binary with the official unofficial-builds glibc-217 build. Node 24 patching is opt-in (seenode24-url) and disabled by default, because no working glibc-217 Node 24 build exists yet — so containers that require Node 24 and a glibc older than 2.28 (GCC ⇐ 6 / Clang ⇐ 5) are unsupported. -
nektos/act support — When running locally with nektos/act, the
/__e/mechanism does not exist. This action installs system Node.js as a fallback. -
git safe.directory — Containers run as root while the workspace may be owned by a different user, causing git to refuse operations. This action sets
safe.directoryto*.
This action must be the first step in a job, before actions/checkout. It requires
no Node.js runtime because it is a composite action that uses only bash steps.
No working glibc-217 Node 24 build exists yet (nodejs/unofficial-builds#190 has not
shipped one, and the Boost mirror build crashes on heavy child_process operations on old
kernels), so Node 24 patching is opt-in and off by default. Containers needing Node 24 on
a pre-2.28 glibc (GCC ⇐ 6 / Clang ⇐ 5) are unsupported until a known-good build can be
passed via node24-url.
|
The C++ Matrix action automatically configures the volume mounts
(/node20217 and /node24) that this action writes to for old containers.
Usage
Basic usage (auto-detects everything):
steps:
- name: Container Bootstrap
uses: alandefreitas/cpp-actions/container-bootstrap@master
Custom Node.js version:
steps:
- name: Container Bootstrap
uses: alandefreitas/cpp-actions/container-bootstrap@master
with:
node-version: '20.11.0'
Custom mirror URL (e.g., Boost mirror at archives.boost.io):
steps:
- name: Container Bootstrap
uses: alandefreitas/cpp-actions/container-bootstrap@master
with:
node-url: 'https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.gz'
Input Parameters
Parameter |
Description |
Default |
|
Node.js version to download from unofficial glibc-217 builds. Used only when the runner’s Node.js binary is broken inside the container. The URL is constructed as: https://unofficial-builds.nodejs.org/download/release/v<VERSION>/node-v<VERSION>-linux-x64-glibc-217.tar.gz NOTE: Node 24 glibc-217 builds do not exist. Only Node 20.x versions are available. |
|
|
Override URL for the Node.js tarball. When non-empty, this URL is used instead of
constructing one from |
|
|
URL of a glibc-217-compatible Node.js 24 tarball to patch into |
|
|
Whether to configure |
|
|
Enable |
|
Outputs
Output |
Description |
|
'true' if a glibc-217-compatible Node.js (20 and/or 24) was downloaded and installed, 'false' otherwise. |
|
'true' if a glibc-217-compatible Node.js 24 was downloaded and installed into /node24, 'false' otherwise. |
|
'true' if system Node.js was installed via apt-get (act workaround), 'false' otherwise. |
|
'true' if git safe.directory was configured, 'false' otherwise. |