ContainerFilesExtensions Methods
ResourceBuilderExtensions.PublishWithContainerFiles . AddContainerFiles(DockerfileStage, IResource, string, ILogger?) Section titled AddContainerFiles(DockerfileStage, IResource, string, ILogger?)extensionDockerfileContainerFilesDestinationAnnotation . public static class ContainerFilesExtensions{ public static DockerfileStage AddContainerFiles( this DockerfileStage stage, IResource resource, string rootDestinationPath, ILogger? logger) { // ... }}Parameters
stageDockerfileresourceIContainerFilesDestinationAnnotation annotations specifying files to copy.rootDestinationPath stringThe root destination path in the container. Relative paths in annotations will be appended to this path.loggerILogger? The logger used for logging information or errors.Returns
DockerfileStage The DockerfileStage to allow for fluent chaining.Remarks
This method processes all Container annotations on the resource and generates COPY --from statements for each source container's files.
For each annotation: Try), COPY statements are generatedrootContainer on the source resource generates a COPY statement
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.
AddContainerFilesStages(DockerfileBuilder, IResource, ILogger?) Section titled AddContainerFilesStages(DockerfileBuilder, IResource, ILogger?)extensionDockerfilepublic static class ContainerFilesExtensions{ public static DockerfileBuilder AddContainerFilesStages( this DockerfileBuilder builder, IResource resource, ILogger? logger) { // ... }}Parameters
builderDockerfileresourceIloggerILogger? An optional logger used to record warnings if container image names cannot be determined for source resources.Returns
DockerfileBuilder The same DockerfileBuilder instance with additional instructions for container files, enabling method chaining.