-
Notifications
You must be signed in to change notification settings - Fork 79
php: add PHP_INI_DIR variable to container #34
Conversation
@petk WDYT? if approved, I'll change other Dockerfiles as well. |
Sure... This would be useful for example for knowing where to install some extension's ini configuration file or something similar? |
yes. I use it for that purpose exactly:
and I do not need to adjust the path when I change base image ;) |
added to all docker files, can be merged now. for the same reason I'd like to add |
Thanks for the info. I would suggest using this workflow with the ini files (for the readme example): RUN ... \
&& echo "memory_limit = 512M" >> $PHP_INI_DIR/php.ini \
&& ... copy-ing entire INI files is not very well organized because the settings might change a lot from version to version. This ini dir is also basically entire configuration directory here... Let me check a bit, otherwise looks good to me. |
I prefer a new file because:
I can remove the readme modification from this and you can write your own instructions. |
also, my instructions did not suggest copy whole .ini file, but only add project specific settings. |
ping @petk |
btw, using this project here: https://github.com/eventum/docker/pull/2/files |
If I'm not mistaken, you need to get the location of the ini directory after you install PHP. So basically, with php 7.4 you can also use Hopefully here everything works correctly then. Thanks for the pull request. |
you can't use scripts if you use |
Yup, that's true. And that's why also echo "ini.directive" >> ... is better and adds less layers to image. |
Now I remember also why there was a single ENV with new lines defined :D - it adds that many layers less. Another measurement of the image simplicity :D |
yeah, but echo has other downsides: no suitable version control (adding another echo will likely git blame previous line as well), total mess with syntax (dosini syntax wrapped in shell syntax, including escaping); no layers caching (all commands in single RUN re-run); more difficult to share (copy the file between projects). typically, single ENV vs multiple ENV add only metadata, not data layers, so not really an issue. if you're worried about layers data, you could use multi staged build and still be efficient in layers caching: FROM alpine AS build
....
FROM scratch
COPY --from=build / . or, to keep alpine layer: FROM alpine AS base
FROM base AS build
....
FROM base
COPY --from=build / . there's also note: this is just a rant, no need real reason to change anything now :) |
I'll check, thanks for the info. Last time I was checking this, there were some recommendations to keep the layers at minimum for such base images that are used further on... |
some random thoughts: I'd keep alpine layer intact. as I might have it cached locally and provides some means to identify layers added by this project. and having multiple layers actually improves download efficiency on first pull, layers are downloaded in parallel, so typically four smaller ones come down faster than one very huge. and of course, this all depends on the downlink. |
@petk any estimation when the image gets rebuilt?
|
$DEPS
variable from the final image$PHP_INI_DIR
to be symmetrical with official php docker image