@@ -44,9 +44,16 @@ public static int StartProcessWithDocker(this BuildContext context, string comm
4444 }
4545 args . Prepend ( command ) ;
4646 args . Prepend ( RuntimeInformation . ProcessArchitecture == Architecture . Arm64 ? DOCKERIMAGE_ARM64 : DOCKERIMAGE_X64 ) ;
47- args . Prepend ( workdir ) ;
47+ foreach ( var environmentVariable in envVariables )
48+ {
49+ args . PrependSwitchQuoted (
50+ "--env" ,
51+ " " ,
52+ $ "{ environmentVariable . Key } ={ environmentVariable . Value } ") ;
53+ }
54+ args . PrependQuoted ( workdir ) ;
4855 args . Prepend ( "-w" ) ;
49- args . Prepend ( $ "{ System . IO . Path . GetFullPath ( "." ) } :/src") ;
56+ args . PrependQuoted ( $ "{ System . IO . Path . GetFullPath ( "." ) } :/src") ;
5057 args . Prepend ( "-v" ) ;
5158 args . Prepend ( "run" ) ;
5259 command = "docker" ;
@@ -55,7 +62,7 @@ public static int StartProcessWithDocker(this BuildContext context, string comm
5562 Arguments = args ,
5663 WorkingDirectory = workingDirectory ,
5764 NoWorkingDirectory = useDocker ,
58- EnvironmentVariables = envVariables ,
65+ EnvironmentVariables = useDocker ? null : envVariables ,
5966 } ;
6067 return context . StartProcess ( command , settings ) ;
6168 }
@@ -65,7 +72,9 @@ public static DirectoryPath MakeAbsoluteForDocker(this BuildContext context, Dir
6572 var useDocker = UseDocker ( context ) ;
6673 if ( useDocker )
6774 {
68- return directoryPath ;
75+ var path = System . IO . Path . GetFullPath ( directoryPath . FullPath ) ;
76+ var relativePath = System . IO . Path . GetRelativePath ( System . IO . Path . GetFullPath ( "." ) , path ) ;
77+ return new DirectoryPath ( $ "/src/{ relativePath } ") ;
6978 }
7079 return context . MakeAbsolute ( directoryPath ) ;
7180 }
0 commit comments