Skip to content

Commit

Permalink
args
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed Aug 6, 2024
1 parent 176644f commit 4bf7716
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/staxfile/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ export default class Compiler {
})
}

private envVarComments(): string {
return Object.entries(this.data.build.args).map(([name, value]) => `# ${name}=${value}\n`).join('')
private args(): string {
return Object.entries(this.data.build.args).map(([name, value]) => `ARG ${name}="${value}"\n`).join('')
}

private parseBase(file: string, includes: Record<string, string>) {
let text = this.envVarComments()
let text = ""

if (!fileExists(file))
exit(1, `File not found: ${file}`)
Expand All @@ -101,7 +101,10 @@ export default class Compiler {
else
text += line + "\n"
})
return this.substituteVariables(text)

text = this.substituteVariables(text)
text = text.replaceAll('# $stax.section args', this.args())
return text
}

private substituteVariables(dockerfile: string): string {
Expand Down

0 comments on commit 4bf7716

Please sign in to comment.