Skip to content

Commit

Permalink
update image uploader console app to work with latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
philasmar committed Oct 17, 2023
1 parent 635e422 commit 3bfe0de
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/AWS.Deploy.DockerImageUploader/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
using System;
using System.Threading.Tasks;
using System.IO;
using System.Linq;
using AWS.Deploy.Common.Recipes;
using AWS.Deploy.Orchestration;
using AWS.Deploy.Orchestration.RecommendationEngine;

namespace AWS.Deploy.DockerImageUploader
{
Expand All @@ -20,6 +24,7 @@ public class App
private readonly IFileManager _fileManager;
private readonly IDirectoryManager _directoryManager;
private readonly IProjectDefinitionParser _projectDefinitionParser;
private readonly IRecipeHandler _recipeHandler;
private readonly CLI.App _deployToolCli;

private readonly List<string> _testApps = new() { "WebApiNET6", "ConsoleAppTask" };
Expand All @@ -29,6 +34,7 @@ public App(IServiceProvider serviceProvider)
_projectDefinitionParser = serviceProvider.GetRequiredService<IProjectDefinitionParser>();
_fileManager = serviceProvider.GetRequiredService<IFileManager>();
_directoryManager = serviceProvider.GetRequiredService<IDirectoryManager>();
_recipeHandler = serviceProvider.GetRequiredService<IRecipeHandler>();
_deployToolCli = serviceProvider.GetRequiredService<CLI.App>();
}

Expand All @@ -49,9 +55,11 @@ public async Task Run()
private async Task CreateImageAndPushToECR(string projectPath)
{
var projectDefinition = await _projectDefinitionParser.Parse(projectPath);

var orchestratorSession = new OrchestratorSession(projectDefinition);
var recommendationEngine = new RecommendationEngine(orchestratorSession, _recipeHandler);
var recommendations = await recommendationEngine.ComputeRecommendations();
var dockerEngine = new DockerEngine.DockerEngine(projectDefinition, _fileManager, _directoryManager);
dockerEngine.GenerateDockerFile();
dockerEngine.GenerateDockerFile(recommendations.First());

var configFilePath = Path.Combine(projectPath, "DockerImageUploaderConfigFile.json");
var deployArgs = new[] { "deploy", "--project-path", projectPath, "--diagnostics", "--apply", configFilePath, "--silent" };
Expand Down

0 comments on commit 3bfe0de

Please sign in to comment.