Skip to content

Conversation

@bilhackmac
Copy link

This little change allow to install extension without enabling it.

It can be useful for preparing base images and speedup sub build in CI context

@JoelLinn
Copy link

If I want to enable the extension later on calling docker-php-ext-enable my-extension would be enough?

@bilhackmac
Copy link
Author

In principle yes… but i'm going a bit fast and i tested with an extension already activated.

I pass the MR in WIP and I correct as soon as I have time

@bilhackmac bilhackmac changed the title Allow to install extension without enabling it [WIP] Allow to install extension without enabling it May 19, 2020
@bilhackmac
Copy link
Author

After doing some more relevant tests I can confirm I did it right.

For exemple test with bcmath

php -m | fgrep bcmath
# <no result>
docker-php-ext-install --no-enable bcmath
# <install output>
php -m | fgrep bcmath
# <no result>
docker-php-ext-enable bcmath
php -m | fgrep bcmath
# bcmath

Another with pdo_mysql

php -m | fgrep pdo_mysql
# <no result>
docker-php-ext-install --no-enable pdo_mysql
# <install output>
php -m | fgrep pdo_mysql
# <no result>
docker-php-ext-enable pdo_mysql
php -m | fgrep pdo_mysql
# pdo_mysql

@bilhackmac bilhackmac changed the title [WIP] Allow to install extension without enabling it Allow to install extension without enabling it May 20, 2020
@yosifkit
Copy link
Member

It can be useful for preparing base images and speedup sub build in CI context

If this is to create custom base images in a CI pipeline to speed up diverse child images, why can't the php modules just be left enabled for all of them?

@bilhackmac
Copy link
Author

All child images do not need all extensions, it is a will on the project to activate only the strict necessary… I know it's not the docker way to install unnecessary resources but it will really speed up my CI

PHP official image
  ├ Install ext A
  ├ Install ext B
  ├ Install ext C
  ├ Install ext D
  └ Copy custom global config
    │ # Child image 1
    ├ Enable ext A
    ├ Enable ext C
    ├ Copy custom image config
    │ # Child image 2
    ├ Enable ext A
    ├ Enable ext B
    ├ Copy custom image config
    │ # Child image 3
    ├ Enable ext B
    ├ Enable ext D
    │ # Child image 4
    ├ Enable ext B
    ├ Enable ext D
    ├ Install and enable ext Z that is the only child image that need it
    │ # Child image X
    ├ Enable ext C
    ├ Copy custom image config
    ┆

Deps are installed only once, extensions are builds only once too.

We can have up to 51 child images… and growing

@yosifkit
Copy link
Member

yosifkit commented Jun 1, 2020

I would have said to just pass --ini-name=/dev/null, but that is only an argument to enable and doesn't handle absolute paths (we'll look to fix those bits).

Why not just rm $PHP_INI_DIR/conf.d/*pdo_mysql* after install?

@bilhackmac
Copy link
Author

Yes I can rm $PHP_INI_DIR/conf.d/* after installing all needed modules, indeed.

I'll just find it's a more convenient way with --no-enable.

So, as you wish, i adapt

@yosifkit
Copy link
Member

yosifkit commented Jun 2, 2020

Added #1021 so that docker-php-ext-install --ini-name=/dev/null will work.

@bilhackmac
Copy link
Author

Thx

@bilhackmac bilhackmac deleted the feature/install-no-enable branch June 3, 2020 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants