From 7f0269a00db4e2599b6d6e6bf945adceeb2a979d Mon Sep 17 00:00:00 2001 From: kira1928 Date: Wed, 15 Jul 2026 23:51:15 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=20Docker=20?= =?UTF-8?q?=E5=86=85=E7=BD=AE=E5=B7=A5=E5=85=B7=E7=9B=AE=E5=BD=95=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/docker-prepare-tools.mjs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/docker-prepare-tools.mjs b/scripts/docker-prepare-tools.mjs index fe89301..f71b43c 100644 --- a/scripts/docker-prepare-tools.mjs +++ b/scripts/docker-prepare-tools.mjs @@ -11,7 +11,8 @@ * 此脚本在 CI 的原生 x86/ARM runner 上运行,避免在 QEMU 中解压大文件 * * 版本号和下载 URL 自动从 src/tools/remote-tools-config.json 读取, - * 无需手动维护版本号的一致性。 + * 无需手动维护版本号的一致性。输出目录遵循 remotetools 的 + * //// 布局。 * * 重要: 解压逻辑必须与 remotetools 的 extractDownloadedFile() 行为一致: * 1. 先解压到临时目录 @@ -206,7 +207,7 @@ function downloadFile(url, destPath) { * 下载并解压工具到目标目录 * 模拟 remotetools 的 extractDownloadedFile() 行为 * @param {string} url - * @param {string} dest - 最终目标目录(例如 tools/ffmpeg/n8.1-latest) + * @param {string} dest - 最终目标目录(例如 tools/linux/amd64/ffmpeg/n8.1-latest) */ async function downloadAndExtract(url, dest) { const filename = basename(new URL(url).pathname); @@ -305,6 +306,11 @@ async function main() { mkdirSync(outputDir, { recursive: true }); + // remotetools 会按 //// 查找工具。 + // Docker 将 outputDir 复制为只读工具根目录,因此这里必须保留平台目录层级。 + const platformOutputDir = join(outputDir, 'linux', arch); + mkdirSync(platformOutputDir, { recursive: true }); + console.log(`=== 为 linux/${arch} 预下载 Docker 内置工具${dryRun ? ' (dry-run)' : ''} ===`); console.log(`配置来源: ${configPath}`); @@ -330,7 +336,7 @@ async function main() { console.log(` 版本: ${result.version}`); console.log(` URL: ${result.url}`); - const destDir = join(outputDir, toolName, result.version); + const destDir = join(platformOutputDir, toolName, result.version); console.log(` 目标: ${destDir}`); if (dryRun) { From a0dbf2031575c961a9f986afe640025ba0e9b6c7 Mon Sep 17 00:00:00 2001 From: kira1928 Date: Thu, 16 Jul 2026 00:07:59 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84=20Docker=20?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E9=A2=84=E4=B8=8B=E8=BD=BD=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/docker-prepare-tools.mjs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/docker-prepare-tools.mjs b/scripts/docker-prepare-tools.mjs index f71b43c..fa18e62 100644 --- a/scripts/docker-prepare-tools.mjs +++ b/scripts/docker-prepare-tools.mjs @@ -304,12 +304,12 @@ async function main() { process.exit(1); } - mkdirSync(outputDir, { recursive: true }); - // remotetools 会按 //// 查找工具。 // Docker 将 outputDir 复制为只读工具根目录,因此这里必须保留平台目录层级。 const platformOutputDir = join(outputDir, 'linux', arch); - mkdirSync(platformOutputDir, { recursive: true }); + if (!dryRun) { + mkdirSync(platformOutputDir, { recursive: true }); + } console.log(`=== 为 linux/${arch} 预下载 Docker 内置工具${dryRun ? ' (dry-run)' : ''} ===`); console.log(`配置来源: ${configPath}`); @@ -351,10 +351,10 @@ async function main() { console.log(`\n=== 所有工具下载完成 (下载: ${downloadCount}, 跳过: ${skipCount}) ===`); // 列出下载结果 - if (existsSync(outputDir)) { - const toolDirs = readdirSync(outputDir); + if (existsSync(platformOutputDir)) { + const toolDirs = readdirSync(platformOutputDir); for (const dir of toolDirs) { - const dirPath = join(outputDir, dir); + const dirPath = join(platformOutputDir, dir); if (statSync(dirPath).isDirectory()) { console.log(` ${dir}/`); }