99using System ;
1010using System . Threading . Tasks ;
1111using System . IO ;
12+ using System . Linq ;
13+ using AWS . Deploy . Common . Recipes ;
14+ using AWS . Deploy . Orchestration ;
15+ using AWS . Deploy . Orchestration . RecommendationEngine ;
1216
1317namespace AWS . Deploy . DockerImageUploader
1418{
@@ -20,6 +24,7 @@ public class App
2024 private readonly IFileManager _fileManager ;
2125 private readonly IDirectoryManager _directoryManager ;
2226 private readonly IProjectDefinitionParser _projectDefinitionParser ;
27+ private readonly IRecipeHandler _recipeHandler ;
2328 private readonly CLI . App _deployToolCli ;
2429
2530 private readonly List < string > _testApps = new ( ) { "WebApiNET6" , "ConsoleAppTask" } ;
@@ -29,6 +34,7 @@ public App(IServiceProvider serviceProvider)
2934 _projectDefinitionParser = serviceProvider . GetRequiredService < IProjectDefinitionParser > ( ) ;
3035 _fileManager = serviceProvider . GetRequiredService < IFileManager > ( ) ;
3136 _directoryManager = serviceProvider . GetRequiredService < IDirectoryManager > ( ) ;
37+ _recipeHandler = serviceProvider . GetRequiredService < IRecipeHandler > ( ) ;
3238 _deployToolCli = serviceProvider . GetRequiredService < CLI . App > ( ) ;
3339 }
3440
@@ -49,9 +55,11 @@ public async Task Run()
4955 private async Task CreateImageAndPushToECR ( string projectPath )
5056 {
5157 var projectDefinition = await _projectDefinitionParser . Parse ( projectPath ) ;
52-
58+ var orchestratorSession = new OrchestratorSession ( projectDefinition ) ;
59+ var recommendationEngine = new RecommendationEngine ( orchestratorSession , _recipeHandler ) ;
60+ var recommendations = await recommendationEngine . ComputeRecommendations ( ) ;
5361 var dockerEngine = new DockerEngine . DockerEngine ( projectDefinition , _fileManager , _directoryManager ) ;
54- dockerEngine . GenerateDockerFile ( ) ;
62+ dockerEngine . GenerateDockerFile ( recommendations . First ( ) ) ;
5563
5664 var configFilePath = Path . Combine ( projectPath , "DockerImageUploaderConfigFile.json" ) ;
5765 var deployArgs = new [ ] { "deploy" , "--project-path" , projectPath , "--diagnostics" , "--apply" , configFilePath , "--silent" } ;
0 commit comments