From d1c647d55345c697a8fbf092fe890cc44ef6ecd0 Mon Sep 17 00:00:00 2001 From: roble Date: Wed, 2 Dec 2026 08:11:55 +0000 Subject: [PATCH] fix: Docker's storage link is relative, so the host can follow it too --- src/Environments/DockerEnvironment.php | 4 +- .../Environments/DockerStorageLinkTest.php | 41 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/Environments/DockerStorageLinkTest.php diff --git a/src/Environments/DockerEnvironment.php b/src/Environments/DockerEnvironment.php index 9d0579f..432fae3 100644 --- a/src/Environments/DockerEnvironment.php +++ b/src/Environments/DockerEnvironment.php @@ -822,7 +822,9 @@ protected function nextSteps(InstallCommand $command): array protected function createStorageLink(InstallCommand $command): void { $command->info('Creating storage link...'); - $this->execInContainer($command, ['php', 'artisan', 'storage:link']); + // Relative: made in the container, but the host serves the app too (E2E, `artisan serve`), + // and an absolute link points at /var/www, which only the container has. + $this->execInContainer($command, ['php', 'artisan', 'storage:link', '--relative']); } protected function printedArtisan(): string diff --git a/tests/Feature/Environments/DockerStorageLinkTest.php b/tests/Feature/Environments/DockerStorageLinkTest.php new file mode 100644 index 0000000..c3f521a --- /dev/null +++ b/tests/Feature/Environments/DockerStorageLinkTest.php @@ -0,0 +1,41 @@ +fakeOptions = ['path' => sys_get_temp_dir()]; + + $docker = new class extends DockerEnvironment + { + public function link(InstallCommand $command): void + { + $this->createStorageLink($command); + } + }; + + $docker->link($command); + + Process::assertRan(fn ($process) => $process->command === ['docker', 'compose', 'exec', '-T', 'app', 'php', 'artisan', 'storage:link', '--relative']); + } +}