Closed ivandokov closed 5 months ago
Thanks for pointing this out @ivandokov!
I took what you did and factored it to support SQLite out of the box.
Since the --isolated
feature depended on certain Laravel versions, I decided to default that to false. Users can enable it if needed.
Here are the updated docs on how this works:
Affected Docker Images
Currently using serversideup/php:beta-8.2-unit but I believe the issue applies to all images
Docker Labels of the affected images
No response
Current Behavior
I am trying to build an image which includes my source code. I bundle all the files and create
database.sqlite
with an entrypoint script. My cache driver is set todatabase
(default for Laravel 11). When I build the image and run it the init setup errors as the migration command has--isolated
from https://github.com/serversideup/docker-php/pull/129. The issue is that this process isolation requires the cache to obtain a lock and the lock cannot be created before the migrations are executed initially so the requried tables are created. This is not the case with any other cache driver.This is the SQL error I receive:
I know this is not directly a docker issue but a Laravel one as the Laravel installer migrates the database locally when the project is created but I don't think the migrated database should be a dependency to the builded image. I think a fresh database is more suitable for a docker image. I think the workaround should be included in the implementation for docker. Maybe a new flag for isolation mode. Something like
AUTORUN_LARAVEL_MIGRATION_ISOLATION=true
Expected Behavior
The initial migrations should be executed successfully.
Steps To Reproduce
Host Operating System
macOS Sonoma 14.2.1
Docker Version
Anything else?
No response