ContainerResourceBuilderExtensions
Classstaticnet10.0
Provides extension methods for
IDistributedApplicationBuilder to add container resources to the application. namespace Aspire.Hosting;
public static class ContainerResourceBuilderExtensions{ // ...}37 members
Methods37
Section titled MethodsIResourceBuilder<ContainerResource> Adds a container resource to the application. Uses the "latest" tag.
IResourceBuilder<ContainerResource> Adds a container resource to the application.
IResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource.
AddDockerfileBuilder(IDistributedApplicationBuilder, string, string, Func<DockerfileBuilderCallbackContext, Task>, string?)extensionexperimentalats exportIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile generated programmatically using the
DockerfileBuilder API. AddDockerfileBuilder(IDistributedApplicationBuilder, string, string, Action<DockerfileBuilderCallbackContext>, string?)extensionexperimentalats ignoredIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile generated programmatically using the
DockerfileBuilder API. AddDockerfileFactory(IDistributedApplicationBuilder, string, string, Func<DockerfileFactoryContext, string>, string?)extensionats ignoredIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile content generated by a synchronous factory function.
AddDockerfileFactory(IDistributedApplicationBuilder, string, string, Func<DockerfileFactoryContext, Task<string>>, string?)extensionats exportIResourceBuilder<ContainerResource> Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile content generated by an asynchronous factory function.
Changes the resource to be published as a container in the manifest.
Adds a bind mount to a container resource.
Adds a build argument when the container is build from a Dockerfile.
Adds a build argument when the container is built from a Dockerfile.
WithBuildSecret(IResourceBuilder<T>, string, IResourceBuilder<ParameterResource>)extensionats export Adds a secret build argument when the container is built from a Dockerfile.
WithContainerCertificatePaths(IResourceBuilder<TResource>, string?, List<string>, List<string>)extensionats ignoredIResourceBuilder<TResource> Adds a
ContainerCertificatePathsAnnotation to the resource that allows overriding the default paths in the container used for certificate trust. Custom certificate trust is only supported at run time. WithContainerFiles(IResourceBuilder<T>, string, IEnumerable<ContainerFileSystemItem>, int?, int?, UnixFileMode?)extensionats ignored Creates or updates files and/or folders at the destination path in the container.
WithContainerFiles(IResourceBuilder<T>, string, Func<ContainerFileSystemCallbackContext, CancellationToken, Task<IEnumerable<ContainerFileSystemItem>>>, int?, int?, UnixFileMode?)extensionats ignored Creates or updates files and/or folders at the destination path in the container. Receives a callback that will be invoked when the container is started to allow the files to be created based on other resources in the application model.
WithContainerFiles(IResourceBuilder<T>, string, string, int?, int?, UnixFileMode?)extensionats ignored Creates or updates files and/or folders at the destination path in the container by copying them from a source path on the host. In run mode, this will copy the files from the host to the container at runtime, allowing for overriding ownership and permissions in the container. In publish mode, this will create a bind mount to the source path on the host.
Overrides the default container name for this resource. By default Aspire generates a unique container name based on the resource name and a random postfix (or a postfix based on a hash of the AppHost project path for persistent container resources). This method allows you to override that behavior with a custom name, but could lead to naming conflicts if the specified name is not unique.
Adds a network alias to container resource.
Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.
WithContainerRuntimeArgs(IResourceBuilder<T>, Action<ContainerRuntimeArgsCallbackContext>)extensionats ignored Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.
WithContainerRuntimeArgs(IResourceBuilder<T>, Func<ContainerRuntimeArgsCallbackContext, Task>)extensionats ignored Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.
Causes Aspire to build the specified container image from a Dockerfile.
Configures custom base images for generated Dockerfiles.
WithDockerfileBuilder(IResourceBuilder<T>, string, Func<DockerfileBuilderCallbackContext, Task>, string?)extensionexperimentalats export Builds the specified container image from a Dockerfile generated by a callback using the
DockerfileBuilder API. WithDockerfileBuilder(IResourceBuilder<T>, string, Action<DockerfileBuilderCallbackContext>, string?)extensionexperimentalats ignored Builds the specified container image from a Dockerfile generated by a synchronous callback using the
DockerfileBuilder API. WithDockerfileFactory(IResourceBuilder<T>, string, Func<DockerfileFactoryContext, string>, string?)extensionats ignored Builds the specified container image from a Dockerfile generated by a synchronous factory function.
WithDockerfileFactory(IResourceBuilder<T>, string, Func<DockerfileFactoryContext, Task<string>>, string?)extensionats export Builds the specified container image from a Dockerfile generated by an asynchronous factory function.
Set whether a container resource can use proxied endpoints or whether they should be disabled for all endpoints belonging to the resource.
Sets the Entrypoint for the container.
Allows overriding the image on a container.
Sets the pull policy for the container resource.
Allows overriding the image registry on a container.
Allows setting the image to a specific sha256 on a container.
Allows overriding the image tag on a container.
Sets the lifetime behavior of the container resource.
Adds a volume to a container resource.
Adds an anonymous volume to a container resource.