If I run composer installfrom my host, I get into the local composer cache:
- Installing deft/iso3166-utility (1.0.0)
Loading from cache
However, when creating a container that has in its Dockerfile:
RUN composer install -n -o --no-dev
I load all things, for example:
- Installing deft/iso3166-utility (1.0.0)
Downloading: 100%
It was expected, but I would like to avoid it. As with recovery, it will also download everything again.
I would like to have a universal cache for the composer, which I could also use for other docker projects.
I studied this and found an approach for defining a volume in a Dockerfile :
ENV COMPOSER_HOME=/var/composer
VOLUME /var/composer
I added this to my Dockerfileand expected that the files will be downloaded only once, and then it will go to the cache.
, -o composer, -o -o docker build. , .
, -?