@@ -63,60 +63,6 @@ await ExecuteContainerCommandAsync(
6363 imageName ) . ConfigureAwait ( false ) ;
6464 }
6565
66- public virtual async Task CopyContainerFilesAsync ( string imageName , string sourcePath , string destinationPath , CancellationToken cancellationToken )
67- {
68- var containerName = $ "temp-{ Guid . NewGuid ( ) : N} ";
69-
70- try
71- {
72- // Create a temporary container from the image
73- _logger . LogDebug ( "Creating temporary container {ContainerName} from image {ImageName}" , containerName , imageName ) ;
74- var createArguments = $ "create --name { containerName } { imageName } ";
75-
76- var createExitCode = await ExecuteContainerCommandWithExitCodeAsync (
77- createArguments ,
78- $ "{ Name } create for {{ContainerName}} from {{ImageName}} failed with exit code {{ExitCode}}.",
79- $ "{ Name } create for {{ContainerName}} from {{ImageName}} succeeded.",
80- cancellationToken ,
81- new object [ ] { containerName , imageName } ) . ConfigureAwait ( false ) ;
82-
83- if ( createExitCode != 0 )
84- {
85- throw new DistributedApplicationException ( $ "{ Name } create failed with exit code { createExitCode } .") ;
86- }
87-
88- // Copy files from the container
89- _logger . LogDebug ( "Copying files from {ContainerName}:{SourcePath} to {DestinationPath}" , containerName , sourcePath , destinationPath ) ;
90- var copyArguments = $ "cp { containerName } :{ sourcePath } { destinationPath } ";
91-
92- await ExecuteContainerCommandAsync (
93- copyArguments ,
94- $ "{ Name } cp from {{ContainerName}}:{{SourcePath}} to {{DestinationPath}} failed with exit code {{ExitCode}}.",
95- $ "{ Name } cp from {{ContainerName}}:{{SourcePath}} to {{DestinationPath}} succeeded.",
96- $ "{ Name } cp failed with exit code {{0}}.",
97- cancellationToken ,
98- containerName , sourcePath , destinationPath ) . ConfigureAwait ( false ) ;
99- }
100- finally
101- {
102- // Clean up the temporary container
103- _logger . LogDebug ( "Removing temporary container {ContainerName}" , containerName ) ;
104- var rmArguments = $ "rm { containerName } ";
105-
106- var rmExitCode = await ExecuteContainerCommandWithExitCodeAsync (
107- rmArguments ,
108- $ "{ Name } rm for {{ContainerName}} failed with exit code {{ExitCode}}.",
109- $ "{ Name } rm for {{ContainerName}} succeeded.",
110- cancellationToken ,
111- new object [ ] { containerName } ) . ConfigureAwait ( false ) ;
112-
113- if ( rmExitCode != 0 )
114- {
115- _logger . LogWarning ( "{RuntimeName} rm for {ContainerName} failed with exit code {ExitCode}." , Name , containerName , rmExitCode ) ;
116- }
117- }
118- }
119-
12066 /// <summary>
12167 /// Executes a container runtime command with standard logging and error handling.
12268 /// </summary>
0 commit comments