Remove --no-scripts from PHP composer install command - #464
Conversation
|
@Spirit55555 I'm not familiar with the PHP ecosystem, unfortunately! So you'll have to walk me through this.
|
In post. yes, it's possible. Maybe add support for an env like
I added a
I do not use a framework and I unfortunately have no experience with development using Laravel. |
|
@Spirit55555 Thanks so much for the detail. I'll need to read up on how all of these PHP frameworks operate a bit more. The tests are failing here, so I can't merge this without understanding the different patterns and improving a generalized solution here. |
|
@iloveitaly The error looks like a file permission issue to me, but I will have to test some to be sure. |
|
@iloveitaly After a bit of testing, it seems like the issue is that Composer is run before the |
|
@Spirit55555 in what cases would an installation process require access to the entire app? Just not familiar with the PHP ecosystem, and in ruby/python/go/typescript (which I'm familiar with) packages generally don't need access to your application source code. The reason we try to separate build from install steps is to enable layer caching to repeats builds are much faster (i.e. if the same dependencies are used, no need to redownload them). |
|
@iloveitaly From the documentation: https://getcomposer.org/doc/articles/scripts.md
There are plenty of examples here on GitHub: https://github.com/search?q=%22post-install-cmd%22&type=code The default is to run the pre/post scripts, so I think there should be very good reasons not to do this. If you want to download the dependencies early in the process, you could run And later: |
|
@Spirit55555 Super helpful. This all makes sense. I need to spend some time with it and think through what changes are breaking, etc. I'm going to be able to get to it this week, but I think I have all of the detail I need from you, which is great. |
|
I think the |
|
Hi there, as a PHP/Laravel developer I can confirm that running For example, dependencies used in local environments for debugging (e.g. I think we should have the ability to choose which flags to pass during installation, such as Adding In my case I've "fixed" the missing post-install script using a start-container.sh. The solution proposed by @Spirit55555 to add a I've used Railpack with a fresh Laravel starter kit project and dev dependencies broke the build because they require a Node.js runtime in the PHP build step. This is expected in a local environment, but in a production-ready pod I don't think the Node.js binary should be present in the same PHP container. I'll try to produce a PoC with some example if needed and make a PR to try this. Best Regards. |
--no-scripts prevents pre-install-cmd and post-install-cmd events from running.
Don't install dev depends.
--no-scriptspreventspre-install-cmdandpost-install-cmdevents from running.I see no reason to prevent this and I had to add a workaround to my own applications, due to this.
It was added as part of this commit: 1547fa7