Skip to content

ResourceContainerImageBuilder should support setting additional arguments for dotnet publish built images #10000

Closed
@captainsafia

Description

@captainsafia

ResourceContainerImageBuilder currently invokes:

$ dotnet publish {projectMetadata.ProjectPath} --configuration Release /t:PublishContainer /p:ContainerRepository={resource.Name}

And doesn't support setting additional properties that callers might want to invoke including:

  • /p:ContainerImageFormat
  • /p:ContainerArchiveOutputPath
  • /p:ContainerRuntimeIdentifier

Callers might need to modify the output format and location of the generated images. The IResourceContainerBuilder should provide an API for passing additional build args to the underlying commands.

public interface IResourceContainerImageBuilder
{
    Task BuildImageAsync(
        IResource resource,
        ContainerBuildOptions? options = null,
        CancellationToken cancellationToken = default);

    Task BuildImagesAsync(
        IEnumerable<IResource> resources,
        ContainerBuildOptions? options = null,
        CancellationToken cancellationToken = default);
}

The ContainerBuildOptions should contain properties that can be be customized on the underlying command.

[Experimental(...)]
public class ContainerBuildOptions
{
  public string OutputPath { get; init; }
  public ContainerImageFormat ImageFormat { get; init; }
  public string TargetPlatform { get; init; }
}

[Experimental(...)]
public enum ContainerImageFormat
{
    Docker,      // default
    OciTar,
    DockerTar
}

The ResourceContainerImageBuilder implementation should be updated to respect these options if they are provided.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions