build-image
build-image copied to clipboard
Specify the version of Composer
The Netlify build is currently using version 2 of Composer, however not all plugins are yet Composer 2 compatible so it would be great if there was a way to specify the version of Composer (or at least 1 vs 2) that is installed.
In general the installer script used in your Dockerfile is also quite outdated (see diff)
It seems like this was copied from the bottom suggestion at https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md which however means you should have regularly updated the commit hash. Alternatively it'd be better to follow the first version of the script.
Since you are using a Dockerfile, it may be easier than either of those 2 documented options to use multistage builds with the official composer image to load the composer.phar file:
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
or if you want to install composer 1 and 2 and then have some script in /usr/local/bin/composer which loads the correct one depending on an env var:
COPY --from=composer:1 /usr/bin/composer /usr/local/bin/composer1
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer2