@@ -11,6 +11,7 @@ namespace DotNet.Testcontainers.Images
1111 using DotNet . Testcontainers . Configurations ;
1212 using ICSharpCode . SharpZipLib . Tar ;
1313 using Microsoft . Extensions . Logging ;
14+ using JetBrains . Annotations ;
1415
1516 /// <summary>
1617 /// Generates a tar archive with Docker configuration files. The tar archive can be used to build a Docker image.
@@ -48,17 +49,17 @@ internal sealed class DockerfileArchive : ITarArchive
4849 /// <param name="logger">The logger.</param>
4950 /// <exception cref="ArgumentException">Thrown when the Dockerfile directory does not exist or the directory does not contain a Dockerfile.</exception>
5051 public DockerfileArchive (
51- string contextDirectory ,
52- string dockerfileDirectory ,
53- string dockerfile ,
54- IImage image ,
55- IReadOnlyDictionary < string , string > buildArguments ,
56- ILogger logger )
52+ [ CanBeNull ] string contextDirectory ,
53+ [ NotNull ] string dockerfileDirectory ,
54+ [ NotNull ] string dockerfile ,
55+ [ NotNull ] IImage image ,
56+ [ NotNull ] IReadOnlyDictionary < string , string > buildArguments ,
57+ [ NotNull ] ILogger logger )
5758 : this (
5859 // The Docker build context wasn't originally supported. To stay backwards
5960 // compatible, the argument is optional and can be null. If it isn't set,
6061 // fall back to the Dockerfile directory.
61- new DirectoryInfo ( contextDirectory ) ,
62+ new DirectoryInfo ( contextDirectory ?? dockerfileDirectory ) ,
6263 new DirectoryInfo ( dockerfileDirectory ) ,
6364 new FileInfo ( Path . Combine ( dockerfileDirectory , dockerfile ) ) ,
6465 new FileInfo ( Path . Combine ( dockerfileDirectory , dockerfile + ".dockerignore" ) ) ,
@@ -80,13 +81,13 @@ public DockerfileArchive(
8081 /// <param name="logger">The logger.</param>
8182 /// <exception cref="ArgumentException">Thrown when the Dockerfile directory does not exist or the directory does not contain a Dockerfile.</exception>
8283 private DockerfileArchive (
83- DirectoryInfo contextDirectory ,
84- DirectoryInfo dockerfileDirectory ,
85- FileInfo dockerfile ,
86- FileInfo dockerignore ,
87- IImage image ,
88- IReadOnlyDictionary < string , string > buildArguments ,
89- ILogger logger )
84+ [ NotNull ] DirectoryInfo contextDirectory ,
85+ [ NotNull ] DirectoryInfo dockerfileDirectory ,
86+ [ NotNull ] FileInfo dockerfile ,
87+ [ NotNull ] FileInfo dockerignore ,
88+ [ NotNull ] IImage image ,
89+ [ NotNull ] IReadOnlyDictionary < string , string > buildArguments ,
90+ [ NotNull ] ILogger logger )
9091 {
9192 if ( ! dockerfileDirectory . Exists )
9293 {
@@ -260,11 +261,11 @@ await tarOutputStream.CloseEntryAsync(ct)
260261 /// <summary>
261262 /// Gets all accepted Docker archive files.
262263 /// </summary>
263- /// <param name="directory ">Directory to Docker configuration files.</param>
264+ /// <param name="path ">Directory to Docker configuration files.</param>
264265 /// <returns>Returns a list with all accepted Docker archive files.</returns>
265- private static IEnumerable < string > GetFiles ( string directory )
266+ private static IEnumerable < string > GetFiles ( string path )
266267 {
267- return Directory . EnumerateFiles ( directory , "*" , SearchOption . AllDirectories )
268+ return Directory . EnumerateFiles ( path , "*" , SearchOption . AllDirectories )
268269 . AsParallel ( )
269270 . Select ( Path . GetFullPath )
270271 . Select ( Unix . Instance . NormalizePath )
0 commit comments