Skip to content

Commit

Permalink
Implemented explicit container resource setup. (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
nscheibe authored Feb 22, 2024
1 parent b52beff commit 01879ed
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Core/ContainerResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public class ContainerResource<TOptions>
/// Initializes the resources
/// </summary>
public async virtual Task InitializeAsync()
{
SetupContainerResource();

await Manager.CreateAndStartContainerAsync();
}

protected virtual void SetupContainerResource()
{
ResourceOptions = new TOptions();
var builder = ContainerResourceBuilder.New();
Expand All @@ -61,7 +68,6 @@ public async virtual Task InitializeAsync()

Manager = new DockerContainerManager(Settings, dockerConfig);
Initializer = new ContainerInitializer(Manager, Settings);
await Manager.CreateAndStartContainerAsync();
}

private void AddNetworksToBuilder(ContainerResourceBuilder builder)
Expand Down Expand Up @@ -129,7 +135,6 @@ public virtual Dictionary<string, string> GetComposeExports()
};
}


/// <summary>
/// Cleans up the resource
/// </summary>
Expand Down

0 comments on commit 01879ed

Please sign in to comment.