The smallest possible size is achievable with installed extensions.
3.1K
The PHP Docker Alpine images support PHP 5.6->8.x and can be used to build Dockerfiles for PHP cli and fpm. By installing the necessary extensions, it's possible to achieve the smallest possible size.
Supported extensions from mlocati/docker-php-extension-installer
1. Built images on docker hub with tags (arm64/amd64):
Installed extension is enabled as by default, you can change enabled by changing env
docker run -e PHP_EXTENSIONS="..." -e CRONTAB="..." --rm vinhphon/php:8.2-cli php -m
2. Rebuild images Clone GitHub repository, then go to cli/fpm folder execute:
docker build -t your-image-tag \
--build-arg SOURCE_ROOT="your working dir" \
--build-arg VERSION="php version" \
--build-arg EXTENSIONS="extensions, seperate by space" \
--build-arg COMPOSER_VERSION="composer version (cli)" \
--build-arg CRONTAB="composer version (cli)" \
--build-arg UID="userID" \
--build-arg GID="groupID" .
3. Extend built images:
In case you want to add more extension with faster build time, you can ref "dev" branch or refer Dockerfile.cli.extend.sample, Dockerfile.fpm.extend.sample
Then you can use rebuild command on #1 for.
* 5.6 -> 7.1: bcmath bz2 calendar exif gd gettext intl mysqli mcrypt opcache pdo_mysql redis soap sockets sysvmsg sysvsem sysvshm xsl zip pcntl
* 7.2 -> 8.x: bcmath bz2 calendar exif gd gettext intl mysqli opcache pdo_mysql redis soap sockets sodium sysvmsg sysvsem sysvshm xsl zip pcntl
Contributions are always welcome! If you'd like to contribute, please open an issue or pull request on the GitHub repository.
This project is licensed under the MIT License.
Content type
Image
Digest
sha256:3d799a714…
Size
74.7 MB
Last updated
over 1 year ago
docker pull vinhphon/php:8.4-cli