Skip to content

Commit

Permalink
ImageBuilder.From(imageAsTag,asName).
Browse files Browse the repository at this point in the history
Closes issue #178
  • Loading branch information
mariotoffia committed Mar 22, 2021
1 parent 1e65487 commit e91f1cb
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Ductus.FluentDocker/Builders/ImageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,31 @@ protected override IBuilder InternalCreate()
/// <summary>
/// Creates a _dockerfile_ builder.
/// </summary>
/// <param name="from">
/// <param name="imageAndTag">
/// 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)
public FileBuilder From(string imageAndTag = null)
{
if (string.IsNullOrEmpty(from))
if (string.IsNullOrEmpty(imageAndTag))
{
return _fileBuilder = new FileBuilder(this);
}

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

public FileBuilder From(string imageAndTag, string asName)
{
if (string.IsNullOrEmpty(imageAndTag))
{
return _fileBuilder = new FileBuilder(this);
}

return _fileBuilder = new FileBuilder(this).From(imageAndTag, asName);
}

public FileBuilder FromFile(string dockerFile)
Expand Down

0 comments on commit e91f1cb

Please sign in to comment.