Skip to content

Conversation

jpnurmi
Copy link
Collaborator

@jpnurmi jpnurmi commented Jul 17, 2025

Publishing a minimal Alpine .NET AOT container on a Mac with Apple silicon requires linux-musl-arm64 as brought up in:

Problem: GitHub Actions hosted Node.js not available for MUSL ARM64

Node.js is required for JS actions, such as actions/checkout. For various reasons, GitHub Actions forces all containers to run a pre-compiled Node.js from the host, bind-mounted to the container in the /__e (aka. "externals") directory. The problem is that there's no suitable pre-compiled version for Linux MUSL ARM64.

A workaround is possible but it gets quite hacky. First of all, we need to bind-mount either /__e/node20 or /__e/node20/bin to "escape" the built-in /__e bind-mount. Secondly, we need to make sure /__e/node20/bin/node points to a working node executable. In our case, we link it to the system installation i.e. /usr/bin/node. Finally, we need to alter /etc/os-release and pretend not to be Alpine (change ID=alpine to anything else) to avoid the following hard-coded Alpine container compatibility check:

Error: JavaScript Actions in Alpine containers are only supported on x64 Linux runners. Detected ...

// Check for Alpine container compatibility
if (!Constants.Runner.PlatformArchitecture.Equals(Constants.Architecture.X64))
{
    var os = Constants.Runner.Platform.ToString();
    var arch = Constants.Runner.PlatformArchitecture.ToString();
    var msg = $"JavaScript Actions in Alpine containers are only supported on x64 Linux runners. Detected {os} {arch}";
    throw new NotSupportedException(msg);
}

https://github.com/actions/runner/blob/main/src/Runner.Worker/Handlers/StepHost.cs

See also:

@jpnurmi jpnurmi force-pushed the fix-linux-musl-arm64 branch 3 times, most recently from a389fe4 to 0938583 Compare July 23, 2025 03:26
jpnurmi added 8 commits July 23, 2025 13:43
Note: [System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier
is available on .NET 5+ but these Native AOT integration tests are only
relevant for .NET 7+ when Native AOT was introduced.
@jpnurmi jpnurmi force-pushed the fix-linux-musl-arm64 branch 3 times, most recently from 831bdac to 49266d7 Compare July 24, 2025 21:46
@jpnurmi jpnurmi force-pushed the fix-linux-musl-arm64 branch from 49266d7 to 46f3953 Compare July 24, 2025 21:53
@jpnurmi jpnurmi marked this pull request as ready for review July 24, 2025 21:58
Copy link
Member

@Flash0ver Flash0ver left a comment

Choose a reason for hiding this comment

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

🤘 ... 2 questions and 1 nitpick

@jpnurmi jpnurmi merged commit 4a25401 into main Jul 25, 2025
49 of 50 checks passed
@jpnurmi jpnurmi deleted the fix-linux-musl-arm64 branch July 25, 2025 19:48
This was referenced Jul 29, 2025
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.

2 participants