Closed dieisraels closed 4 months ago
This problem is not related at all with the install-php-extensions
script.
What's failing is the curl
part: it can't download the install-php-extensions
script (so, install-php-extensions
isn't executed at all).
In order to have a (correct) failure build, you should:
curl
to exit with a failure in case of errors: that's done by using the -f
option (so, use curl -sSLf
instead of curl -sSL
)set -o pilefail
sh
doesn't understand set -o pilefail
, you have to instruct docker to use bash
instead of sh
for the RUN
scripts: that's done by adding a SHELL ["/bin/bash", "-c"]
line to the dockerfileTo sum it all up, the Dockerfile should be something like this:
FROM php:8.3-fpm-bookworm
SHELL ["/bin/bash", "-c"]
RUN set -o pipefail && \
curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s \
@composer apcu bcmath exif gd gmagick iconv intl redis mysqli pcntl pdo_mysql soap xml xsl zip
Another solution would be to use any other method to fetch and run install-php-extensions
- see the README (and that's what I prefer)
Another (simpler) solution is the one I suggested here: https://github.com/mlocati/docker-php-extension-installer/commit/45759d1b6c9b8cb83dabaf960a598b98e5ee333b
Version of install-php-extensions
2.2.17
Error description
It can happen that the installation is not successful if, for example, the sources are not available. Here is an example of the output in our Bitbucket pipeline:
In this case, the Docker build does not abort, but simply continues to run. As we run this process automatically, we usually do not see the error. The build process should abort in the step if the installation was not successful.
Or do we need to implement this differently in the Dockerfile?
Docker image
php:8.3-fpm-bookworm
Minimal Dockerfile