Skip to content
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

Allow disabling cache via command line #7895

Closed
wyqydsyq opened this issue Jan 17, 2019 · 7 comments
Closed

Allow disabling cache via command line #7895

wyqydsyq opened this issue Jan 17, 2019 · 7 comments
Labels
Milestone

Comments

@wyqydsyq
Copy link

wyqydsyq commented Jan 17, 2019

Re-open of #1896

There is a very valid use case for wanting to completely disable the cache - Docker.

Best practices for building slim Docker images are to disable or clear caches for all package managers. There is absolutely zero benefit from having cached packages in a Docker image, it just consumes space.

We can of course delete the cache files after in a seperate command - however it seems pretty standard for modern package managers to now offer this as a CLI option, see: PIP, APK, Yarn is also looking at implementing it.

@alcohol
Copy link
Member

alcohol commented Jan 17, 2019

I do not understand how Docker is "a very valid" use-case. I use Docker extensively and the Composer cache is not an issue, especially since multi-stage builds were introduced. Your production container should only contain your build artifact, there shouldn't be anything related to Composer inside of it if you are doing it right.

@Dzhuneyt
Copy link
Contributor

Already solved in pull request #7880

Feel free to review the code and mark it as approved if you think it makes sense. That would bring it closer to release.

@alcohol
Copy link
Member

alcohol commented Jan 17, 2019

The above can already be achieved by running, just FYI

COMPOSER_CACHE_DIR=/dev/null composer <command>

@Dzhuneyt
Copy link
Contributor

I agree, but following the discussion in #6650 and more specifically - your comment (#6650 (comment)), I was under the impression that such a feature will be useful.

@Fleshgrinder correctly pointed out in his comment

Users need to find that out on their own, instead of simply getting the answer from composer --help.

I believe that having this feature as "built-in" AND crossplatform out of the box, is much better than resorting to undocumented tricks with setting environment variables in the command line.

@stof
Copy link
Contributor

stof commented Jan 17, 2019

environment variables supported by Composer are documented: https://getcomposer.org/doc/03-cli.md#environment-variables

@alcohol
Copy link
Member

alcohol commented Jan 17, 2019

Indeed, they are documented and they are also cross platform.. anyway, a flag that does exactly the same does not hurt I guess. It's only a few lines of code. And if it makes some people happy for some reason, that's a win I guess 🤷‍♂️

@Seldaek Seldaek added this to the 1.9 milestone Jan 28, 2019
@Seldaek
Copy link
Member

Seldaek commented Jul 30, 2019

Fixed by #7880

@Seldaek Seldaek closed this as completed Jul 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants