diff --git a/app/Services/BuildService.php b/app/Services/BuildService.php index 005ba5e..92e9eed 100644 --- a/app/Services/BuildService.php +++ b/app/Services/BuildService.php @@ -122,8 +122,18 @@ public function setVersion(string $version) { protected function createTemporaryDirectory(): string { $directory = './.rancherize/'; - if (!file_exists($directory)) - mkdir($directory); + if (!file_exists($directory)) { + mkdir($directory); + + /** + * Set user/group corresponding to executing user + */ + if ( !empty($_ENV['USER_ID']) ) + chown($directory, (int) getenv('USER_ID')); + + if ( !empty($_ENV['GROUP_ID']) ) + chgrp($directory, (int) getenv('GROUP_ID')); + } return $directory; }