Skip to content

Commit

Permalink
Try fix docker cache sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
AydinHassan committed May 25, 2024
1 parent 01703d4 commit b6940af
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Process/DockerProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function create(ProcessInput $processInput): Process
$mounts = [];
if ($processInput->getExecutable() === 'composer') {
//we need to mount a volume for composer cache
$mounts[] = $this->composerCacheDir . ':/root/.composer/cache';
$mounts[] = $this->composerCacheDir . ':/tmp/composer';
}

$env = [];
Expand All @@ -40,6 +40,9 @@ public function create(ProcessInput $processInput): Process
$env[] = $key . '=' . $value;
}

$env[] = '-e';
$env[] = 'COMPOSER_HOME=/tmp/composer';

return new Process(
[
...$this->baseComposeCommand($mounts, $env),
Expand All @@ -48,7 +51,11 @@ public function create(ProcessInput $processInput): Process
...$processInput->getArgs(),
],
$this->basePath,
['SOLUTION' => $processInput->getWorkingDirectory()],
[
'SOLUTION' => $processInput->getWorkingDirectory(),
'UID' => getmyuid(),
'GID' => getmygid(),
],
$processInput->getInput(),
10,
);
Expand All @@ -74,6 +81,8 @@ private function baseComposeCommand(array $mounts, array $env): array
'-f',
'.docker/runtime/docker-compose.yml',
'run',
'--user',
getmyuid() . ':' . getmygid(),
'--rm',
...$env,
'-w',
Expand Down

0 comments on commit b6940af

Please sign in to comment.