From 095077824639fb60cfa1d974109342a324f36554 Mon Sep 17 00:00:00 2001 From: Kien La Date: Sun, 22 Sep 2024 14:14:52 -0400 Subject: [PATCH] use cached compose filename --- src/container.ts | 2 +- src/staxfile/index.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/container.ts b/src/container.ts index 0d5251b..79d8fe0 100644 --- a/src/container.ts +++ b/src/container.ts @@ -91,7 +91,7 @@ export default class Container { } get composeFile(): string { - return this._composeFile ||= new Staxfile({ context: this.context, source: this.source, staxfile: this.staxfile, app: this.app }).compile() + return this._composeFile ||= new Staxfile({ context: this.context, source: this.source, staxfile: this.staxfile, app: this.app }).cachedComposeFile } get forwardedPorts(): string[] { diff --git a/src/staxfile/index.ts b/src/staxfile/index.ts index 8b207a8..ac2af37 100644 --- a/src/staxfile/index.ts +++ b/src/staxfile/index.ts @@ -39,8 +39,12 @@ export default class Staxfile { return cacheDir } + public get cachedComposeFile(): string | null { + return path.join(this.cacheDir, 'compose.yaml') + } + public compile(force: boolean = false): string { - const composeFile = path.join(this.cacheDir, 'compose.yaml') + const composeFile = this.cachedComposeFile if (!force && existsSync(composeFile)) { const cachedStats = statSync(composeFile)