From 5026f54a6d4482226951d3a8196218ea41434db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Wed, 23 Mar 2022 20:48:55 +0100 Subject: [PATCH] fix path prefixing --- CONTRIBUTING.md | 13 +++++++++++++ Dockerfile | 2 +- docker-compose.override.yml | 5 +++++ src/Bootstrappers/FilesystemTenancyBootstrapper.php | 4 +++- tests/BootstrapperTest.php | 2 +- tests/Etc/tmp/queuetest.json | 0 6 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 docker-compose.override.yml delete mode 100644 tests/Etc/tmp/queuetest.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7dce1b82..a5a6ec3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,3 +9,16 @@ StyleCI will flag code style violations in your pull requests. Run `docker-compose up -d` to start the containers. Then run `./test` to run the tests. When you're done testing, run `docker-compose down` to shut down the containers. + +### Docker on M1 + +You can add: +```yaml +services: + mysql: + platform: linux/amd64 + mysql2: + platform: linux/amd64 +``` + +to `docker-compose.override.yml` to make `docker-compose up-d` work on M1. diff --git a/Dockerfile b/Dockerfile index 06d97aea..36f52d6a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \ # && if [ "${PHP_VERSION}" = "7.4" ]; then docker-php-ext-configure gd --with-freetype --with-jpeg; else docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; fi \ && docker-php-ext-install -j$(nproc) gd pdo pdo_mysql pdo_pgsql pdo_sqlite pgsql zip gmp bcmath pcntl ldap sysvmsg exif \ # install the redis php extension - && pecl install redis-5.3.2 \ + && pecl install redis-5.3.7 \ && docker-php-ext-enable redis \ # install the pcov extention && pecl install pcov \ diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 00000000..29e9fb37 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,5 @@ +services: + mysql: + platform: linux/amd64 + mysql2: + platform: linux/amd64 diff --git a/src/Bootstrappers/FilesystemTenancyBootstrapper.php b/src/Bootstrappers/FilesystemTenancyBootstrapper.php index 418be93f..dcd7299e 100644 --- a/src/Bootstrappers/FilesystemTenancyBootstrapper.php +++ b/src/Bootstrappers/FilesystemTenancyBootstrapper.php @@ -67,7 +67,9 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper ); if (! $finalPrefix) { - $finalPrefix = $originalRoot . '/'. $suffix; + $finalPrefix = $originalRoot + ? $originalRoot . '/'. $suffix + : $suffix; } $this->app['config']["filesystems.disks.{$disk}.root"] = $finalPrefix; diff --git a/tests/BootstrapperTest.php b/tests/BootstrapperTest.php index 29aa7dc9..588fadd8 100644 --- a/tests/BootstrapperTest.php +++ b/tests/BootstrapperTest.php @@ -194,7 +194,7 @@ class BootstrapperTest extends TestCase // Check that disk prefixes respect the root_override logic $this->assertSame($expected_storage_path . '/app/', $this->getDiskPrefix('local')); $this->assertSame($expected_storage_path . '/app/public/', $this->getDiskPrefix('public')); - $this->assertSame('tenant' . tenant('id') . '/', ltrim($this->getDiskPrefix('s3'), '/')); + $this->assertSame('tenant' . tenant('id') . '/', $this->getDiskPrefix('s3'), '/'); // Check suffixing logic $new_storage_path = storage_path(); diff --git a/tests/Etc/tmp/queuetest.json b/tests/Etc/tmp/queuetest.json deleted file mode 100644 index e69de29b..00000000