@@ -328,12 +328,17 @@ async function installRequirements(targetFolder, pluginInstance, funcOptions) {
328328 }
329329 // Install requirements with pip
330330 // Set the ownership of the current folder to user
331- pipCmds . push ( [
332- 'chown' ,
333- '-R' ,
334- `${ process . getuid ( ) } :${ process . getgid ( ) } ` ,
335- '/var/task' ,
336- ] ) ;
331+ // If you use docker-rootless, you don't need to set the ownership
332+ if ( options . dockerRootless !== true ) {
333+ pipCmds . push ( [
334+ 'chown' ,
335+ '-R' ,
336+ `${ process . getuid ( ) } :${ process . getgid ( ) } ` ,
337+ '/var/task' ,
338+ ] ) ;
339+ } else {
340+ pipCmds . push ( [ 'chown' , '-R' , '0:0' , '/var/task' ] ) ;
341+ }
337342 } else {
338343 // Use same user so --cache-dir works
339344 dockerCmd . push ( '-u' , await getDockerUid ( bindPath , pluginInstance ) ) ;
@@ -346,12 +351,16 @@ async function installRequirements(targetFolder, pluginInstance, funcOptions) {
346351 if ( process . platform === 'linux' ) {
347352 if ( options . useDownloadCache ) {
348353 // Set the ownership of the download cache dir back to user
349- pipCmds . push ( [
350- 'chown' ,
351- '-R' ,
352- `${ process . getuid ( ) } :${ process . getgid ( ) } ` ,
353- dockerDownloadCacheDir ,
354- ] ) ;
354+ if ( options . dockerRootless !== true ) {
355+ pipCmds . push ( [
356+ 'chown' ,
357+ '-R' ,
358+ `${ process . getuid ( ) } :${ process . getgid ( ) } ` ,
359+ dockerDownloadCacheDir ,
360+ ] ) ;
361+ } else {
362+ pipCmds . push ( [ 'chown' , '-R' , '0:0' , dockerDownloadCacheDir ] ) ;
363+ }
355364 }
356365 }
357366
0 commit comments