@@ -328,12 +328,17 @@ async function installRequirements(targetFolder, pluginInstance, funcOptions) {
328
328
}
329
329
// Install requirements with pip
330
330
// 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
+ }
337
342
} else {
338
343
// Use same user so --cache-dir works
339
344
dockerCmd . push ( '-u' , await getDockerUid ( bindPath , pluginInstance ) ) ;
@@ -346,12 +351,16 @@ async function installRequirements(targetFolder, pluginInstance, funcOptions) {
346
351
if ( process . platform === 'linux' ) {
347
352
if ( options . useDownloadCache ) {
348
353
// 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
+ }
355
364
}
356
365
}
357
366
0 commit comments