diff --git a/build/gulpfile.reh.ts b/build/gulpfile.reh.ts index cb1a0a5..375851e 100644 --- a/build/gulpfile.reh.ts +++ b/build/gulpfile.reh.ts @@ -159,5 +159,16 @@ function getNodeChecksum(expectedName: string): string | undefined { function extractAlpinefromDocker(nodeVersion: string, platform: string, arch: string) { - const imageName = arch === 'arm64' ? 'arm64v8/node' : 'node'; + let imageName = 'node'; + let dockerPlatform = ''; + + if (arch === 'arm64') { + imageName = 'arm64v8/node'; + + const architecture = cp.execSync(`docker info --format '{{json .Architecture}}'`, { encoding: 'utf8' }).trim(); + if (architecture != '"aarch64"') { + dockerPlatform = '--platform=linux/arm64'; + } + } + log(`Downloading node.js ${nodeVersion} ${platform} ${arch} from docker image ${imageName}`); - const contents = cp.execSync(`docker run --rm ${imageName}:${nodeVersion}-alpine /bin/sh -c 'cat \`which node\`'`, { maxBuffer: 100 * 1024 * 1024, encoding: 'buffer' }); + const contents = cp.execSync(`docker run --rm ${dockerPlatform} ${imageName}:${nodeVersion}-alpine /bin/sh -c 'cat \`which node\`'`, { maxBuffer: 200 * 1024 * 1024, encoding: 'buffer' }); // eslint-disable-next-line local/code-no-dangerous-type-assertions