-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix cache rebuild #169
base: main
Are you sure you want to change the base?
Fix cache rebuild #169
Conversation
Specifically designed to re-run composer install in a cached build.
Didn't add labels. |
Thanks for the PR @badri @sophiewigmore @effulgentsia - thoughts? |
@arjun024 the web directory will contain custom business logic in addition to housing the downloaded composer modules. So, caching it and restoring will override the custom logic. Instead, what we can do is, re-run composer install in that phase so that composer will place the already downloaded modules from that layer into the appropriate locations under Of course, I'm eager to hear opinions of others :) I've been using paketo buildpacks since Drupal 8 and I had to resort to creating my own buildpacks to circumvent this problem where I was essentially doing the same thing. |
@badri can you explain a bit more about what you mean by this? What type of errors do you encounter when you do this? Overall, if re-running P.S. thanks for the contribution! |
@@ -268,6 +268,30 @@ func runComposerInstall( | |||
logger.Debug.Subprocess(fmt.Sprintf("- %s", f.Name())) | |||
} | |||
} | |||
if os.Getenv("BP_RUN_COMPOSER_INSTALL") == "1" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do end up going with the environment variable, we usually use booleans for this type of environment variable, so I'd want to see this changed to true/false. I'd also want to see this env. var documented in the README with the rest of the configurations.
Let's not make these changes until we (you and @paketo-buildpacks/php-maintainers) are in agreement about how to do this
Summary
Resolve #107
Use Cases
Certain frameworks, most notably Drupal, place modules and themes downloaded from
composer install
in directories other than thevendor
directory. During a cache restore phase for the composer install buildpack, this will get erased because of which the final image won't serve the web application.This is fixed by running
composer install
even if the cached layer is being reused. This places the already downloaded and cached dependencies in the appropriate non-vendor directories. This can be toggled by setting theBP_RUN_COMPOSER_INSTALL
env var to1
.Checklist