magento / magento-cloud-docker

All Submissions you make to Magento Inc. (“Magento") through GitHub are subject to the following terms and conditions: (1) You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission") you submit through GitHub. (2) Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. (3) You agree to the Contributor License Agreement found here: https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html
Open Software License 3.0
256 stars 192 forks source link

Composer cache gets cleared everytime #361

Open Axel29 opened 1 year ago

Axel29 commented 1 year ago

Preconditions

  1. Magento Cloud Docker with PHP >= 8.1

Steps to reproduce

  1. Executing any Docker command within a PHP container such as bin/magento-docker bash
  2. Check out the output

Expected result

  1. No cache is cleared

Actual result

  1. Full composer cache gets cleared

Additional information

This is due to the fact that the docker-entrypoint.sh has the following lines now:

# Configure composer
[ ! -z "${COMPOSER_VERSION}" ] && \
    composer clearcache && \
    composer self-update $COMPOSER_VERSION

because of that, Composer's cache is always cleared when the COMPOSER_VERSION environment variable is set.

This is very annoying since by default the local (host machine) Composer cache directory is a volume to the Docker's Composer cache directory, meaning that Magento Cloud Docker would clear the entire Composer cache everytime we run any command that runs the PHP container...