magento / magento/magento-cloud-docker

Composer cache gets cleared everytime

Open
#361 0 comments 0 reactions 0 assignees View on GitHub
Progress: ready for grooming
Dominant language
PHP
Stars
277
Forks
187
PR merge metrics
No merged PRs in 30d

Description

### 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:

```sh
# 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...

Contributor guide

Open the contributing guide

Research direction

Start with docker-entrypoint.sh and inspect the Composer setup around COMPOSER_VERSION. Reproduce the issue with bin/magento-docker bash in a PHP container, then verify that invoking Docker commands no longer clears the shared Composer cache while the requested Composer version behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.