From 9145394da788189fcfb71abb5f0b0580c98e89d5 Mon Sep 17 00:00:00 2001 From: Hweinstock Date: Fri, 28 Aug 2026 01:50:51 +0000 Subject: [PATCH] fix(binary): address missing dockerfile in container agents --- .../{Dockerfile => Dockerfile.template} | 0 src/core/project/templates/fsTree.test.ts | 15 +++++++++++++++ src/core/project/templates/fsTree.ts | 10 +++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) rename src/assets/templates/hello-world-python-container/{Dockerfile => Dockerfile.template} (100%) diff --git a/src/assets/templates/hello-world-python-container/Dockerfile b/src/assets/templates/hello-world-python-container/Dockerfile.template similarity index 100% rename from src/assets/templates/hello-world-python-container/Dockerfile rename to src/assets/templates/hello-world-python-container/Dockerfile.template diff --git a/src/core/project/templates/fsTree.test.ts b/src/core/project/templates/fsTree.test.ts index bdf4e0503..1ad93cc74 100644 --- a/src/core/project/templates/fsTree.test.ts +++ b/src/core/project/templates/fsTree.test.ts @@ -83,4 +83,19 @@ describe("FsTreeNode.fromAssetSource", () => { ]); expect(await tree.children[2]?.bytes?.()).toBe("contents:template/gitignore.template"); }); + + test("strips .template suffix from non-ignore files", async () => { + const source: AssetSource = { + async list() { + return ["template/Dockerfile.template", "template/dockerignore.template"]; + }, + async read(assetPath) { + return `contents:${assetPath}`; + }, + }; + + const tree = await FsTreeNode.fromAssetSource(source, "template", "root"); + + expect(tree.children.map((node) => node.name)).toEqual(["Dockerfile", ".dockerignore"]); + }); }); diff --git a/src/core/project/templates/fsTree.ts b/src/core/project/templates/fsTree.ts index d388cbe96..ec9171d42 100644 --- a/src/core/project/templates/fsTree.ts +++ b/src/core/project/templates/fsTree.ts @@ -118,9 +118,13 @@ export class FsTreeNode { } /** - * Ignore templates are renamed to dotfiles because npm strips real dotfiles when publishing. + * Render filenames according to the following rules: + * - *ignore.template -> .*ignore to support `.` files. + * - *.template -> * to support extensionless files. */ function renderName(filename: string): string { - const ignore = filename.match(/^(git|npm|docker)ignore\.template$/); - return ignore ? `.${ignore[1]}ignore` : filename; + const ignoreMatchResult = filename.match(/^(git|npm|docker)ignore\.template$/); + if (ignoreMatchResult) return `.${ignoreMatchResult[1]}ignore`; + if (filename.endsWith(".template")) return filename.slice(0, -".template".length); + return filename; }