How to set up the Jenkins php environment in docker?

problem description

my Jenkins was started with docker, and now I want to use it to execute composer install-- no-dev command to install dependencies. I found that there is no plug-in to install PHP (there is a plug-in called Phing, which is used to perform a series of build tasks, but does not provide php ). I compiled PHP on the host, then mounted / usr/local/bin/php into the container, and found

.
php: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

it seems that the shared library has not been found. How do you do it?

May.27,2022

php > installed by the host cannot be used inside the container. Extensions and other things exist in the host, but they do not exist in the corresponding place inside the container. Either you mount the extension directory to the specified location inside the container again and again according to the error message, or install php completely inside the container. Personally, I think it's best to install php in the container, and then update the base image.

Menu