Skip to content

Commit

Permalink
Add build command (#51)
Browse files Browse the repository at this point in the history
useful if you need to make edits to containers, and dont want to lose your custom edits to manifest files
  • Loading branch information
prom3theu5 authored Nov 26, 2023
1 parent a3740e7 commit e1a0968
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Aspirate.Cli/AspirateCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public AspirateCli()
{
AddCommand(new InitCommand());
AddCommand(new GenerateCommand());
AddCommand(new BuildCommand());
AddCommand(new ApplyCommand());
AddCommand(new DestroyCommand());
}
Expand Down
10 changes: 10 additions & 0 deletions src/Aspirate.Cli/Commands/Build/BuildCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Aspirate.Cli.Commands.Build;

public sealed class BuildCommand : BaseCommand<BuildOptions, BuildCommandHandler>
{
public BuildCommand() : base("build", "Builds and pushes containers")
{
AddOption(SharedOptions.AspireProjectPath);
AddOption(SharedOptions.NonInteractive);
}
}
13 changes: 13 additions & 0 deletions src/Aspirate.Cli/Commands/Build/BuildCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Aspirate.Cli.Commands.Build;

public sealed class BuildCommandHandler(IServiceProvider serviceProvider) : BaseCommandOptionsHandler<BuildOptions>(serviceProvider)
{
public override Task<int> HandleAsync(BuildOptions options) =>
ActionExecutor
.QueueAction(LoadConfigurationAction.ActionKey)
.QueueAction(GenerateAspireManifestAction.ActionKey)
.QueueAction(LoadAspireManifestAction.ActionKey)
.QueueAction(PopulateContainerDetailsAction.ActionKey)
.QueueAction(BuildAndPushContainersAction.ActionKey)
.ExecuteCommandsAsync();
}
7 changes: 7 additions & 0 deletions src/Aspirate.Cli/Commands/Build/BuildOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Aspirate.Cli.Commands.Build;

public sealed class BuildOptions : ICommandOptions
{
public string ProjectPath { get; set; } = AspirateLiterals.DefaultAspireProjectPath;
public bool NonInteractive { get; set; } = false;
}
1 change: 1 addition & 0 deletions src/Aspirate.Cli/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
global using Aspirate.Cli.Actions.Containers;
global using Aspirate.Cli.Actions.Manifests;
global using Aspirate.Cli.Commands.Apply;
global using Aspirate.Cli.Commands.Build;
global using Aspirate.Cli.Commands.Destroy;
global using Aspirate.Cli.Commands.Generate;
global using Aspirate.Cli.Commands.Init;
Expand Down
6 changes: 6 additions & 0 deletions src/Aspirate.Cli/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"workingDirectory": "$(ProjectDir)/../../../aspire/samples/eShopLite/AppHost",
"hotReloadEnabled": false
},
"build": {
"commandName": "Project",
"commandLineArgs": "build",
"workingDirectory": "$(ProjectDir)/../../../aspire/samples/eShopLite/AppHost",
"hotReloadEnabled": false
},
"apply": {
"commandName": "Project",
"commandLineArgs": "apply",
Expand Down

0 comments on commit e1a0968

Please sign in to comment.