DockerfileBuildAnnotation Methods
Class Methods 2 members
Represents an annotation for customizing a Dockerfile build.
EmitDockerfileArtifactsAsync(DockerfileFactoryContext, string?) Section titled EmitDockerfileArtifactsAsync(DockerfileFactoryContext, string?) Task Emits all generated Dockerfile artifacts for this annotation.
public class DockerfileBuildAnnotation{ public Task EmitDockerfileArtifactsAsync( DockerfileFactoryContext context, string? dockerfilePath = null) { // ... }}Parameters
context DockerfileFactoryContext The context containing services and resource information. dockerfilePath string? optional The optional Dockerfile path to emit to. When specified, the materialized Dockerfile is copied to this path and any generated sibling files are emitted next to it. When omitted, artifacts are emitted next to DockerfileBuildAnnotation.DockerfilePath. Returns
Task A task representing the asynchronous operation. Remarks
This method materializes a Dockerfile from
DockerfileBuildAnnotation.DockerfileFactory when present, then emits generated companion files such as BuildKit's per-Dockerfile .dockerignore sibling. Use this instead of calling DockerfileBuildAnnotation.MaterializeDockerfileAsync directly when the caller intends to pass the resulting Dockerfile path to a Docker/BuildKit-compatible builder. MaterializeDockerfileAsync(DockerfileFactoryContext, CancellationToken) Section titled MaterializeDockerfileAsync(DockerfileFactoryContext, CancellationToken) Task Materializes the Dockerfile from the factory if it hasn't been materialized yet. This method is thread-safe and ensures the Dockerfile is only written once.
public class DockerfileBuildAnnotation{ public Task MaterializeDockerfileAsync( DockerfileFactoryContext context, CancellationToken cancellationToken) { // ... }}Parameters
context DockerfileFactoryContext The context containing services and resource information. cancellationToken CancellationToken The cancellation token. Returns
Task A task representing the asynchronous operation.