mlocati/docker-php-extension-installer

Add a parameter for a specific target directory to place the compiled binaries in

Closed this issue · 2 comments

So I'm making a Docker image and I wanted to use the multi-stage feature to compile the PHP extensions in a stage and copy the compiled extensions into the final stage with my PHP project.

However, I've noticed that the extensions directory varies and isn't static.

Could you add a feature where I can add a new parameter with a path to a target directory where the compiled extensions will be placed? Then I can easily copy the compiled extensions from the compilation / build stage into the final stage.

Can't you simply retrieve the directory where the PHP extensions are stored?

Here's sample Dockerfile excerpt:

RUN install-php-extensions amqp

RUN PHP_EXT_DIR="$(php -r 'echo realpath(ini_get("extension_dir"));')" && \
    cp "$PHP_EXT_DIR/amqp.so" /where/you/want/to/store/compiled/extensions

Yeah, I guess you're right.