Skip to content

Commit

Permalink
Made from image name in From optional, Issue #179
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotoffia committed Mar 17, 2021
1 parent 8460e6f commit 0b37d76
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Ductus.FluentDocker/Builders/ImageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,23 @@ protected override IBuilder InternalCreate()
return new ImageBuilder(this);
}

public FileBuilder From(string from)
{
/// <summary>
/// Creates a _dockerfile_ builder.
/// </summary>
/// <param name="from">
/// Optional image to specify as FROM. If omitted, it is up to the caller to specify _UseParent_ or _From_.
/// </param>
/// <returns>
/// A newly created filebuilder. If empty or null string the `FileBuilder` is empty. Otherwise it has populated
/// the `FileBuilder` with a parent of the specified image name (via _UseParent()_).
/// </returns>
public FileBuilder From(string from = null)
{
if (string.IsNullOrEmpty(from))
{
return _fileBuilder = new FileBuilder(this);
}

return _fileBuilder = new FileBuilder(this).UseParent(from);
}

Expand Down

0 comments on commit 0b37d76

Please sign in to comment.