Sign inSign up

dockerphpext/elastic-apm

By dockerphpext

•Updated 6 months ago

Image
0

699

dockerphpext/elastic-apm repository overview

⁠Docker PHP Extensions

This project provides pre-compiled PHP extension Docker images, designed to make installing PHP extensions fast and lightweight.

GitHub Repository: https://github.com/docker-php-ext/Dockerfile⁠

By using these pre-compiled images, you can avoid long build times and heavy dependencies (like build-base, autoconf, gcc, etc.) in your final production images.

⁠🚀 How it works

Each extension is built into an Alpine-based Docker image. During the build, we extract:

  1. The compiled .so extension file.
  2. The necessary shared libraries (.so) that the extension depends on.
  3. A pre-configured .ini file to enable the extension.

These artifacts are stored in /opt/php/ within the extension image, allowing you to easily COPY them into your own Docker images.

⁠📦 Usage

To use an extension in your Dockerfile, simply copy the files from the corresponding extension image.

⁠Example: Installing elastic-apm for PHP 8.3
FROM php:8.3-alpine

# Enable PHP extensions, this is critical for the extension to work
ENV PHP_INI_SCAN_DIR=/opt/php/conf.d:/usr/local/etc/php/conf.d

# Copy extensions and their dependencies from pre-compiled images
COPY --from=dockerphpext/elastic-apm:php8.3-alpine /opt/php/ /opt/php/

Note: Docker images are hosted on Docker Hub under the dockerphpext⁠ user.

⁠🛠 Supported Extensions

Currently, we support the following extensions for PHP versions 8.0, 8.1, 8.2, 8.3, 8.4, and 8.5:

  • bcmath, calendar, exif, elastic-apm, gettext, gmp, grpc, igbinary, imagick, imap, intl, ldap, memcache, memcached, mongodb, msgpack, mysqli, opcache, pcntl, pcov, pdo_mysql, pdo_pgsql, protobuf, redis, sockets, uuid, xdebug, xmlrpc, xsl, yaml, zip

(Check the extensions/ directory for the most up-to-date list.)

⁠🔨 Local Development

You can build and test extensions locally using the provided Makefile.

⁠Build an extension
make build extension=redis php_version=8.3
⁠Run tests for an extension
make run-single-test extension=redis php_version=8.3
⁠Run tests for all versions of an extension
make run-test extension=redis

⁠🏗 Project Structure

  • extensions/: Contains Dockerfiles for each extension and PHP version.
  • scripts/: Helper scripts used during the build process.
  • tests/: Test suite to ensure extensions are compiled and load correctly.
  • .github/workflows/: GitHub Actions for automated building, testing, and releasing.

⁠📜 License

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

Tag summary

Content type

Image

Digest

sha256:9f755e890…

Size

5.5 MB

Last updated

6 months ago

docker pull dockerphpext/elastic-apm:php8.3-alpine