Skip to content
This repository has been archived by the owner on Mar 13, 2019. It is now read-only.

How to mount the composer cache into the container? #101

Open
iammichiel opened this issue Aug 31, 2016 · 4 comments
Open

How to mount the composer cache into the container? #101

iammichiel opened this issue Aug 31, 2016 · 4 comments

Comments

@iammichiel
Copy link

iammichiel commented Aug 31, 2016

Hi,

I would like to share my host composer cache with the container cache. How can I proceed?
I have already tried the following :

docker run -ti -v $PWD:/data -w /data composer/composer install -w ~/.composer:/root/.composer --ignore-platform-reqs
@alcohol
Copy link

alcohol commented Oct 5, 2016

To my knowledge, the COMPOSER_HOME is set to /composer, so to mount your host cache inside the container you would need to mount your host COMPOSER_HOME (probably ~/.composer, but check to be sure) onto /composer.

Also you had the switch wrong for mounting the volume, it is -v, not -w.

So, -v ~/.composer:/composer.

@evgeniy-baba
Copy link

@iammichiel
Hi.
For me work this solution:

docker run --rm -e "SYMFONY_ENV=prod" -v $(WORKING_DIR):/app -v ~/.composer/cache:/composer/cache composer/composer:1.1 install --ignore-platform-reqs --no-dev

@vitalyzhakov
Copy link

Caching dependencies is very useful feature. Can be example for volumes configuration in README.md?

@brandontamm
Copy link

I have a challenge...I use the local runtime binary method of running composer locally (so I dont have a ~./composer folder with cache. ... can I cache composer locally when using that method still?

EXTRA KUDOS if you could provide a way to include the composer cache during Dockerfile builds or as docker-compose volumes on other projects :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants