|
46 | 46 |
|
47 | 47 | # Dynamic files in the filesystem root of the base image
|
48 | 48 | dynamicRootFiles = pkgs.runCommandNoCC "dynamic-root-files" {} ''
|
49 |
| - mkdir -p $out/run $out/usr/bin $out/bin |
| 49 | + mkdir -p $out/run $out/usr/bin $out/bin $out/lib64 |
50 | 50 | cp -R -Ls ${env} $out/run/profile
|
51 | 51 | cp -R -Ls ${env}/etc $out/etc
|
52 | 52 | ln -s ${pkgs.coreutils}/bin/env $out/usr/bin/env
|
53 | 53 | ln -s ${pkgs.bashInteractive}/bin/sh $out/bin/sh
|
| 54 | +
|
| 55 | + # So that this image can be used as a GitHub Action container directly |
| 56 | + # Needed because it calls its own (non-nix-patched) node binary which uses |
| 57 | + # this dynamic linker path. See also the LD_LIBRARY_PATH assignment below, |
| 58 | + # which provides the necessary libraries for that binary |
| 59 | + ln -s ${pkgs.glibc}/lib/ld-linux-x86-64.so.2 $out/lib64/ld-linux-x86-64.so.2 |
54 | 60 | '';
|
55 | 61 |
|
56 | 62 | # All contents of the root filesystem
|
@@ -115,6 +121,11 @@ in pkgs.dockerTools.buildImage {
|
115 | 121 | "USER=root"
|
116 | 122 | # Needed by some nix commands like nix-store to display output
|
117 | 123 | "PAGER=/run/profile/bin/less"
|
| 124 | + # By default, the linker added in dynamicRootFiles can only find glibc |
| 125 | + # libraries, but the node binary from the GitHub Actions runner also |
| 126 | + # depends on libstdc++.so.6, which is glibc/stdenv. Using LD_LIBRARY_PATH |
| 127 | + # is the easiest way to inject this dependency |
| 128 | + "LD_LIBRARY_PATH=${lib.makeLibraryPath [ pkgs.stdenv.cc.cc ]}" |
118 | 129 | ];
|
119 | 130 | } // lib.optionalAttrs (nixHash != null) {
|
120 | 131 | # Embed a nixHash into the image if given, allowing later extraction via skopeo inspect
|
|
0 commit comments