ContainerResourceBuilderExtensions.AddDockerfileFactory Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| AddDockerfileFactory(IDistributedApplicationBuilder, String, String, Func<DockerfileFactoryContext,String>, String) |
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) |
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. |
AddDockerfileFactory(IDistributedApplicationBuilder, String, String, Func<DockerfileFactoryContext,String>, String)
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.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ContainerResource> AddDockerfileFactory(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, string contextPath, Func<Aspire.Hosting.ApplicationModel.DockerfileFactoryContext,string> dockerfileFactory, string? stage = default);
static member AddDockerfileFactory : Aspire.Hosting.IDistributedApplicationBuilder * string * string * Func<Aspire.Hosting.ApplicationModel.DockerfileFactoryContext, string> * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ContainerResource>
<Extension()>
Public Function AddDockerfileFactory (builder As IDistributedApplicationBuilder, name As String, contextPath As String, dockerfileFactory As Func(Of DockerfileFactoryContext, String), Optional stage As String = Nothing) As IResourceBuilder(Of ContainerResource)
Parameters
- name
- String
The name of the resource.
- contextPath
- String
Path to be used as the context for the container image build.
- dockerfileFactory
- Func<DockerfileFactoryContext,String>
A synchronous function that returns the Dockerfile content as a string.
- stage
- String
The stage representing the image to be published in a multi-stage Dockerfile.
Returns
Remarks
The contextPath is relative to the AppHost directory unless it is fully qualified.
The factory function is invoked once during the build process to generate the Dockerfile content. The output is trusted and not validated.
Applies to
AddDockerfileFactory(IDistributedApplicationBuilder, String, String, Func<DockerfileFactoryContext,Task<String>>, String)
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.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ContainerResource> AddDockerfileFactory(this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, string contextPath, Func<Aspire.Hosting.ApplicationModel.DockerfileFactoryContext,System.Threading.Tasks.Task<string>> dockerfileFactory, string? stage = default);
static member AddDockerfileFactory : Aspire.Hosting.IDistributedApplicationBuilder * string * string * Func<Aspire.Hosting.ApplicationModel.DockerfileFactoryContext, System.Threading.Tasks.Task<string>> * string -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ContainerResource>
<Extension()>
Public Function AddDockerfileFactory (builder As IDistributedApplicationBuilder, name As String, contextPath As String, dockerfileFactory As Func(Of DockerfileFactoryContext, Task(Of String)), Optional stage As String = Nothing) As IResourceBuilder(Of ContainerResource)
Parameters
- name
- String
The name of the resource.
- contextPath
- String
Path to be used as the context for the container image build.
- dockerfileFactory
- Func<DockerfileFactoryContext,Task<String>>
An asynchronous function that returns the Dockerfile content as a string.
- stage
- String
The stage representing the image to be published in a multi-stage Dockerfile.
Returns
Remarks
The contextPath is relative to the AppHost directory unless it is fully qualified.
The factory function is invoked once during the build process to generate the Dockerfile content. The output is trusted and not validated.