laravel-bridge
laravel-bridge copied to clipboard
[v2] Issues with Build Server
While upgrading to Bref 2, I looked over at the Laravel bridge improvements and I decided to retire my own bridge.
I use AWS CodeBuild to build the project before releasing. That entails
- Composer Install
- PHPUnit run
- Composer Install --no-dev
When Composer Installs without dev dependencies, it crashes with errors such as [...] CollisionServiceProvider not found. This seems to be caused by the fact that composer install will generate a cache of packages.php and services.php.
It might also be relevant that on the first run, BrefServiceProvider has not been downloaded yet and it's likely that the cache files are written down in bootstrap/cache/ standard folder.
I managed to fix this by doing two things: defining environment variables for the cache files and creating the storage directories outside of Lambda.
- LAMBDA_TASK_ROOT=/var/task
- APP_SERVICES_CACHE=/tmp/storage/bootstrap/cache/services.php
- APP_PACKAGES_CACHE=/tmp/storage/bootstrap/cache/packages.php
These are the variables I added to my docker-compose setup for the build process.
The change to the original bootstrap/app.php seemed necessary because 1) the /tmp/storage folder does not exist by default and 2) the bref-init.php file is not being executed when running outside of Lambda (i.e. build server).
I'm not sure what recommendation/documentation/suggestion should be made to accommodate this usecase, so I thought I'd at least open a issue to allow folks to read through my approach to solving this.
This seems like a build pipeline issue, not so much one in this package. Or am I missing something? I can successfully run a composer install --no-dev on my projects.