From 86b0428845f72bc1e3d4e9f5c44044cc4ec0f8c2 Mon Sep 17 00:00:00 2001 From: Sean Sundberg Date: Thu, 4 Jul 2024 00:28:58 -0500 Subject: [PATCH] Generates Dockerfile and gitignore files Signed-off-by: Sean Sundberg --- src/models/file.model.ts | 15 +++++++++++++++ src/services/iascable/iascable.impl.ts | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/models/file.model.ts b/src/models/file.model.ts index 8d27fa9..a42b57a 100644 --- a/src/models/file.model.ts +++ b/src/models/file.model.ts @@ -62,5 +62,20 @@ credentials.auto.tfvars .terraform/ `); } +} + +export class DockerIgnoreFile implements OutputFile { + name: string = '.dockerignore'; + type: OutputFileType = OutputFileType.documentation; + + private gitIgnore: OutputFile; + constructor() { + this.gitIgnore = new GitIgnoreFile(); + } + + contents(options?: { flatten?: boolean }): Promise { + return this.gitIgnore.contents() + .then(contents => contents + '\n\nlaunch.sh') + } } diff --git a/src/services/iascable/iascable.impl.ts b/src/services/iascable/iascable.impl.ts index e25fd8f..98efca6 100644 --- a/src/services/iascable/iascable.impl.ts +++ b/src/services/iascable/iascable.impl.ts @@ -21,7 +21,7 @@ import { BillOfMaterialModuleById, BillOfMaterialModuleByName, BillOfMaterialVariable, - CustomResourceDefinition, + CustomResourceDefinition, DockerIgnoreFile, DotGraph, DotGraphFile, getAnnotation, @@ -209,6 +209,7 @@ export class CatalogBuilder implements IascableApi { supportingFiles: [ new UrlFile({name: 'launch.sh', url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/launch.sh', type: OutputFileType.executable}), new GitIgnoreFile(), + new DockerIgnoreFile(), ] }) } @@ -562,8 +563,13 @@ class IascableSolutionResultImpl implements IascableSolutionResult { } addSupportFiles(): void { - this.supportingFiles.push(new UrlFile({name: 'apply.sh', type: OutputFileType.executable, url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/apply-all-terragrunt-variables.sh'})) + this.supportingFiles.push(new UrlFile({name: 'configure-and-apply.sh', type: OutputFileType.executable, url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/apply-all-terragrunt-variables.sh'})) + this.supportingFiles.push(new UrlFile({name: 'configure.sh', url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/configure.sh', type: OutputFileType.executable})) + this.supportingFiles.push(new UrlFile({name: 'apply.sh', type: OutputFileType.executable, url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/apply-all-terragrunt.sh'})) this.supportingFiles.push(new UrlFile({name: 'destroy.sh', type: OutputFileType.executable, url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/destroy-all-terragrunt.sh'})) + this.supportingFiles.push(new UrlFile({name: '.gitignore', type: OutputFileType.executable, url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/gitignore'})) + this.supportingFiles.push(new UrlFile({name: 'Dockerfile', type: OutputFileType.executable, url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/Dockerfile'})) + this.supportingFiles.push(new UrlFile({name: '.dockerignore', type: OutputFileType.executable, url: 'https://raw.githubusercontent.com/cloud-native-toolkit/automation-solutions/main/common-files/dockerignore'})) this.supportingFiles.push(new SolutionBomReadmeFile(this.billOfMaterial)) }