ContainerFilesExtensions.AddContainerFiles 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.
Adds COPY --from statements to the Dockerfile stage for container files from resources referenced by ContainerFilesDestinationAnnotation.
public static Aspire.Hosting.ApplicationModel.Docker.DockerfileStage AddContainerFiles(this Aspire.Hosting.ApplicationModel.Docker.DockerfileStage stage, Aspire.Hosting.ApplicationModel.IResource resource, string rootDestinationPath, Microsoft.Extensions.Logging.ILogger? logger);
static member AddContainerFiles : Aspire.Hosting.ApplicationModel.Docker.DockerfileStage * Aspire.Hosting.ApplicationModel.IResource * string * Microsoft.Extensions.Logging.ILogger -> Aspire.Hosting.ApplicationModel.Docker.DockerfileStage
<Extension()>
Public Function AddContainerFiles (stage As DockerfileStage, resource As IResource, rootDestinationPath As String, logger As ILogger) As DockerfileStage
Parameters
- stage
- DockerfileStage
The Dockerfile stage to add container file copy statements to.
- resource
- IResource
The resource that may have ContainerFilesDestinationAnnotation annotations specifying files to copy.
- rootDestinationPath
- String
The root destination path in the container. Relative paths in annotations will be appended to this path.
- logger
- ILogger
The logger used for logging information or errors.
Returns
The DockerfileStage to allow for fluent chaining.
Remarks
This method processes all ContainerFilesDestinationAnnotation annotations on the resource and generates COPY --from statements for each source container's files.
For each annotation:
This is typically used when building container images that need to include files from other containers, such as copying static assets from a frontend build container into a backend API container.