A customised version of the offical image for php.
10K+
A customised version of the offical image for php.
The image includes the extensions used across different hipages projects.
All PHP configuration parameters can be controlled via environment variables. A list of all environment variables can be found in php.ini.template.
The syntax for the environment variables translates as follow:
All characters UPPERCASED, dots (.) replaced by underscores (_).
Examples:
| php.ini | Environment |
|---|---|
short_open_tag | PHP_SHORT_OPEN_TAG |
session.save_handler | PHP_SESSION_SAVE_HANDLER |
The image allows to customisation via the entrypoint without the need to override the existing entrypoint script.
This is done via hooks that are executed at different stages in the entrypoint script.
Available Hooks:
| Hook | Directory | Description |
|---|---|---|
| Pre-Configuration Hook | /etc/docker/hooks/config/pre | Executes before the php.ini files are generated from the templates. This allows for adding additonal INI templates in /usr/local/etc/php/conf.d. |
| Post-Configuration Hook | /etc/docker/hooks/config/post | Executes after PHP has been configured and before the actual PHP/PHP-FPM process runs. |
The scripts need to end in .sh and need to be executable by /bin/sh.
The directories can have multiple shell scripts which are executed in alphabetical order.
It is recommended prefixing the scripts with a number, e.g. 001_myscript.sh.
Dockerfile Example:
COPY ./001_my-before-script.sh /etc/docker/hooks/config/pre/
COPY ./002_my-after-script.sh /etc/docker/hooks/config/post/
Additinonal INI templates can be placed in /usr/local/etc/php/conf.d allowing to customise the configuration process in case the existing php.ini.template doesn't provide the required option.
COPY ./my-custom-config.ini.template /usr/local/etc/php/conf.d/
The my-custom-config.ini.template will converted via the p2cli utility.
p2cli is using pongo2, a Django-syntax like template-engine.
Get the PHP version of the container:
docker run -it --rm hipages/php:latest php -v
Access the container via shell:
docker run -it --rm hipages/php:latest /bin/sh
Extending the container:
FROM hipages/php:latest
LABEL maintainer "hipages DevOps Team <[email protected]>"
VOLUME ["/var/www/html"]
COPY ./ /var/www/html/
Find more examples in the offical repository.
The following tags are being used for this image:
7.1-fpm-alpine – Primary tag, being used for buildsbuild-<TRAVIS_BUILD_ID> – Used when build in travis<PHP_VERSION>-fpm-alpine – Specific PHP version & container tag7-fpm-alpine – PHP major version tag7.1-fpm-alpine-<CONTAINER_VERSION> – Container version tagphp-<PHP_VERSION> – PHP Version tagThe container version is managed in VERSION.
If libraries or important parts of the container change this will be manually bumped up.
The build, test & release process is managed via travis. Each commit will trigger a build via travis and release the container.
make build.make test.Content type
Image
Digest
Size
137.5 MB
Last updated
over 7 years ago
docker pull hipages/php