-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use AUTRORUN_LARAVEL_OPTIMIZE
to run Laravel's artisan optimize
command.
#511
base: main
Are you sure you want to change the base?
Use AUTRORUN_LARAVEL_OPTIMIZE
to run Laravel's artisan optimize
command.
#511
Conversation
Huh, found out The optimize function has a new argument that'll be useful here from. v11.38. You can use Caveat here is using older versions of Laravel, they wouldn't support this. |
I think this might be ready for review / discussion now. I've added this into the script so that the I will mention, I'm not too well-versed in I'd say a future development of this could be that the optimization skips can be specified by a single environment variable, such as |
Thanks! I will take a peek once I get a moment. The challenging part is we cannot use Bash (/bin/bash), we must use Shell (/bin/sh) 🙃 I'll review and see what we have going on. I want to make sure the user experience is great for existing users (especally ones before Laravel 11) and the upgrade is seamless. I'll keep you posted! |
Made a few changes to make sure it has better compatibility with Shell (it does use POSIX right?), and with the script getting a bit bigger from adding the extra logic I decided to refactor the artisan calls into their own functions. I can reverse the refactoring if preferred. |
Co-authored-by: Paul <[email protected]>
Thanks! Yes, it should be /bin/sh and POSIX compliant. I'll review sometime (likely next week) as this week has been a busy client week. I greatly appreciate you tackling this! I also just approved the workflow, so hopefully it will build some preliminary images to test with on DockerHub |
docs/content/docs/7.reference/1.environment-variable-specification.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Erik Gaal <[email protected]>
Co-authored-by: Erik Gaal <[email protected]>
Co-authored-by: Erik Gaal <[email protected]>
As discussed in #510 .
This draft PR will allow for an additional, optional environment variable that will run
php artisan optimize
instead of the usual separate cache commands.The purpose of this is that other dependencies hook into this command which cannot be easily accounted for in the autorun. However, the fact that the individual cache functions can be configured to be enabled or disabled means we can't simply switch to
optimize
.Instead, we can check if the new environment variable
AUTRORUN_LARAVEL_OPTIMIZE
is set to true. If it is, we simply runartisan optimize
. If the variable is not set (or is set to false), then call thecache_laravel
function, which performs the same logic as always.By default,
AUTRORUN_LARAVEL_OPTIMIZE
will be resolved to false if not specified, so the original & default configuration for the Dockerfile will be preserved.