This repository provides PHP Docker images based on official PHP images, but with GRPC extension pre-compiled and installed. This saves significant build time in your projects since GRPC compilation can take several minutes.
- Faster builds: GRPC is already compiled, saving 5-10 minutes per build
- Automatic updates: Images are automatically built when new PHP versions are released
- Drop-in replacement: Same base as official PHP images, just with GRPC added
- Multiple variants: Supports CLI, FPM, Apache, and Alpine variants
- Multi-platform: Built for both AMD64 and ARM64 (Apple Silicon M1/M2/M3 chips)
Images are published to both Docker Hub and GitHub Container Registry:
clegginabox/php-grpc:8.2-cli
clegginabox/php-grpc:8.2-fpm
clegginabox/php-grpc:8.2-apache
clegginabox/php-grpc:8.3-cli
clegginabox/php-grpc:8.3-fpm
clegginabox/php-grpc:8.3-apache
clegginabox/php-grpc:8.5-cli
clegginabox/php-grpc:8.5-fpm
clegginabox/php-grpc:8.5-apache
ghcr.io/clegginabox/php-grpc:8.2-cli
ghcr.io/clegginabox/php-grpc:8.2-fpm
ghcr.io/clegginabox/php-grpc:8.2-apache
ghcr.io/clegginabox/php-grpc:8.3-cli
ghcr.io/clegginabox/php-grpc:8.3-fpm
ghcr.io/clegginabox/php-grpc:8.3-apache
ghcr.io/clegginabox/php-grpc:8.5-cli
ghcr.io/clegginabox/php-grpc:8.5-fpm
ghcr.io/clegginabox/php-grpc:8.5-apache
All images support both linux/amd64 and linux/arm64 platforms.
Simply replace your PHP base image:
# Instead of:
FROM php:8.2-cli
# Use (Docker Hub):
FROM clegginabox/php-grpc:8.2-cli
# Or (GitHub Container Registry):
FROM ghcr.io/clegginabox/php-grpc:8.2-cliThe GRPC extension is already installed and enabled. You can verify with:
# Using Docker Hub
docker run --rm clegginabox/php-grpc:8.2-cli php -m | grep grpc
# Using GHCR
docker run --rm ghcr.io/clegginabox/php-grpc:8.2-cli php -m | grep grpcThese images work seamlessly on both Intel/AMD and Apple Silicon Macs:
# Works on both architectures
docker run --rm clegginabox/php-grpc:8.3-cli php --version
# Explicitly specify platform if needed
docker run --platform linux/arm64 --rm clegginabox/php-grpc:8.3-cli php --versionThis repository automatically tracks official PHP releases and builds images for:
- PHP 8.1 (cli, fpm, apache)
- PHP 8.2 (cli, fpm, apache)
- PHP 8.3 (cli, fpm, apache)
- PHP 8.4 (cli, fpm, apache)
- PHP 8.5 (cli, fpm, apache) - Special handling*
PHP 8.5 Note: GRPC doesn't currently build on PHP 8.5 using the standard method. The build system automatically tries the standard build first, and if it fails, falls back to building GRPC from PR #40337 which includes PHP 8.5 support. Alpine variants are not available for PHP 8.5 yet. Once the PR is merged and released, the standard build will work automatically and Alpine support will be added.
- GitHub Actions checks for new PHP versions on DockerHub daily
- When a new version is detected, it automatically builds matching images for both AMD64 and ARM64 architectures
- Images are pushed to both Docker Hub and GitHub Container Registry
- You get the latest PHP with GRPC pre-installed automatically, optimized for your platform
To build images locally:
# Build a specific version
./build.sh 8.2 cli
# Build all variants for a version
./build.sh 8.2 all
# Build all versions
./build.sh all allEach image includes:
- Base official PHP image (matching version and variant)
- GRPC extension (latest stable version)
- All dependencies required for GRPC
The installation uses the excellent docker-php-extension-installer tool, which handles all dependencies automatically.
To enable automatic publishing to Docker Hub, you need to set up repository secrets:
- Go to your repository Settings > Secrets and variables > Actions
- Add the following secrets:
DOCKERHUB_USERNAME: Your Docker Hub usernameDOCKERHUB_TOKEN: Your Docker Hub access token (create one at https://hub.docker.com/settings/security)
GitHub Container Registry works automatically without additional setup.
Contributions are welcome! If you'd like to:
- Add support for additional PHP extensions
- Improve build times
- Add new PHP versions or variants
Please open an issue or pull request.
MIT License - See LICENSE file for details.