DockerfileBuildAnnotation
Classnet10.0
Represents an annotation for customizing a Dockerfile build.
namespace Aspire.Hosting.ApplicationModel;
public class DockerfileBuildAnnotation : Aspire.Hosting.ApplicationModel.IResourceAnnotation{ // ...}13 members
Constructors1
Section titled Constructors Represents an annotation for customizing a Dockerfile build.
Properties10
Section titled PropertiesBuildContextIgnoreContentget; setstring? Gets or sets the default
.dockerignore content to emit alongside the published Dockerfile using BuildKit's per-Dockerfile ignore convention ( <dockerfile-name>.dockerignore next to the Dockerfile). DockerfileFactoryget; initFunc<DockerfileFactoryContext, Task<string>> Gets or sets the factory function that generates Dockerfile content dynamically. When set, this factory will be invoked to generate the Dockerfile content at build time, and the content will be written to a generated file path.
HasEntrypointget; setbool Gets or sets a value indicating whether an entry point is defined in the Dockerfile.
ImageNameget; setstring? Gets or sets the image name for the generated container image. When set, this will be used as the container image name instead of the value from ContainerImageAnnotation.
ImageTagget; setstring? Gets or sets the image tag for the generated container image. When set, this will be used as the container image tag instead of the value from ContainerImageAnnotation.
Methods2
Section titled MethodsTask Emits all generated Dockerfile artifacts for this annotation.
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.