fix-node-docker.patch 1.2 KB

1234567891011121314151617181920212223
  1. diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js
  2. index e12a33e..9300d62 100644
  3. --- a/build/gulpfile.reh.js
  4. +++ b/build/gulpfile.reh.js
  5. @@ -188,5 +188,16 @@ function getNodeChecksum(expectedName) {
  6. function extractAlpinefromDocker(nodeVersion, platform, arch) {
  7. - const imageName = arch === 'arm64' ? 'arm64v8/node' : 'node';
  8. + let imageName = 'node';
  9. + let dockerPlatform = '';
  10. +
  11. + if (arch === 'arm64') {
  12. + imageName = 'arm64v8/node';
  13. +
  14. + const architecture = cp.execSync(`docker info --format '{{json .Architecture}}'`, { encoding: 'utf8' }).trim();
  15. + if (architecture != '"aarch64"') {
  16. + dockerPlatform = '--platform=linux/arm64';
  17. + }
  18. + }
  19. +
  20. log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from docker image ${imageName}`);
  21. - const contents = cp.execSync(`docker run --rm ${imageName}:${nodeVersion}-alpine /bin/sh -c 'cat \`which node\`'`, { maxBuffer: 100 * 1024 * 1024, encoding: 'buffer' });
  22. + const contents = cp.execSync(`docker run --rm ${dockerPlatform} ${imageName}:${nodeVersion}-alpine /bin/sh -c 'cat \`which node\`'`, { maxBuffer: 200 * 1024 * 1024, encoding: 'buffer' });
  23. return es.readArray([new File({ path: 'node', contents, stat: { mode: parseInt('755', 8) } })]);