Docker PHP Extension Images provide pre-compiled PHP extensions for various PHP versions and architectures. These images simplify the integration of PHP extensions into your projects by eliminating the need for local compilation.
- Pre-compiled Extensions: Save time by using pre-compiled PHP extensions.
- Multiple PHP Versions: Supports PHP versions from 7.4 up to 8.3.
- Alpine and Debian Base: Currently available for Alpine Linux with plans to support Debian.
- Multi-Architecture Support: Compiled for both
amd64
andarm64
, ensuring compatibility with MacOS and various server environments. - Easy Integration: Simple Docker commands to integrate extensions into your projects without local compilation.
- PHP 7.4
- PHP 8.0
- PHP 8.1
- PHP 8.2
- PHP 8.3
- Alpine Linux: Lightweight and secure base image.
- Debian (Planned): Upcoming support for Debian-based images.
amd64
arm64
Pull the desired PHP extension image from Docker Hub:
docker pull someblackmagic/docker-php-extension-images:<php-version>-<extension>-<system>
docker pull someblackmagic/docker-php-extension-images:8.2-mcrypt-alpine
Use the COPY --from directive in your Dockerfile to include the compiled extensions in your project image.
COPY --from=someblackmagic/docker-php-extension-images:<php-version>-<extension>-<system> /path/to/extensions /path/in/your/image
or
COPY --from=someblackmagic/docker-php-extension-images:<php-version>-<extension>-<system> / /
FROM php:8.2-fpm-alpine
RUN set -eux \
&& apk upgrade --available \
&& apk add curl autoconf build-base autoconf automake git gcc make g++ \
&& true
# Copy mcrypt extension from the pre-built image
COPY --from=someblackmagic/docker-php-extension-images:8.2-mcrypt-alpine / /
If you need multiple extensions, you can copy them from different pre-built images or create a custom image that includes all required extensions.
FROM php:8.2-fpm-alpine
RUN set -eux \
&& apk upgrade --available \
&& apk add curl autoconf build-base autoconf automake git gcc make g++ \
&& true
# Copy mcrypt extension
COPY --from=someblackmagic/docker-php-extension-images:8.2-mcrypt-alpine / /
# Copy another extension, e.g., xdebug
COPY --from=someblackmagic/docker-php-extension-images:8.2-xdebug-alpine / /
This project is licensed under the MIT License.