Sign inSign up

yannoff/php-fpm

By yannoff

•Updated 28 days ago

A PHP-FPM image based on Alpine, enriched with composer & offenbach

Image
0

7.0K

yannoff/php-fpm repository overview

⁠yannoff/docker-php-fpm

A PHP-FPM⁠ docker⁠ image based on Alpine⁠, with composer⁠ and offenbach⁠ installed.

⁠Available tags

(1) Those PHP versions have now reached their EOL⁠.

⁠Usage

⁠Building custom images

Dynamic builds allow for flexible, fine-tuned and featherweight images.
The recommended way is to use the repository URL⁠ as build context.

Example: Integration in a docker-compose⁠ stack

  • PHP version 8.0
  • gd and imap extensions
  • patch extra package install
  • Europe/Rome as timezone
  • laravel/installer as a composer global package
  • latest-preview version of composer
# docker-compose.yaml
fpm:
    build:
        context: https://github.com/yannoff/docker-php-fpm.git#:8.0
        args:
            TZ: Europe/Rome
            PHP_EXTS: gd imap
            APK_EXTRA: patch
            PHP_LIBS: laravel/installer
            COMPOSER_VERSION: latest-preview

Alternatively, building from the command-line:

docker                                     \
    build                                  \
    -t php8.0                              \
    --build-arg TZ="Europe/Rome"           \
    --build-arg PHP_EXTS="gd imap"         \
    --build-arg APK_EXTRA=patch            \
    --build-arg PHP_LIBS=laravel/installer \
    --build-arg COMPOSER_VERSION=latest-preview   \
    [email protected]:yannoff/docker-php-fpm.git#:8.0
⁠Build arguments reference

The following build arguments⁠ are available:

Build argDescriptionDefaults
TZThe timezone to use for the containerUTC
PHP_EXTSPHP extensions to be installed (2)pdo_mysql pdo_pgsql intl opcache bcmath
APK_BASEBase alpine⁠ packages to be installedbash git vim
APK_EXTRAExtra alpine⁠ packages to be installed-
PHP_LIBSPHP libraries to be installed as composer global dependencies-
COMPOSER_VERSIONSpecific composer⁠ version to be installed (3)2.2.25
OFFENBACH_VERSIONAlternative offenbach⁠ version to be installed (4)latest
OFFENBACH_FILENAMEAlternative name for the offenbach⁠ executableoffenbach
OFFENBACH_INSTALL_DIRInstall dir for the offenbach⁠ executable/usr/bin

(2) See the mlocati/docker-php-extension-installer⁠ repository for the full list of supported extensions.
(3) May be latest-preview, latest-stable, or an exact version - eg: 2.4.0.
(4) The version must be an exact version, eg: 1.6.2. If left empty, the latest release will be used.

⁠Using base images

On the other hand, the base pre-compiled images from dockerhub⁠ may be convenient to run⁠ php or composer commands on the fly, providing a minimal PHP ecosystem.

Example: Creating a new laravel⁠ empty project

docker                  \
    run                 \
    --rm                \
    -it                 \
    -u $UID:$GID        \
    -w /src             \
    -v $PWD:/src        \
    yannoff/php-fpm:8.0 \
    composer create-project --ignore-platform-reqs laravel/laravel acme

Since the base image may not contain all of the required PHP extensions, the --ignore-platform-reqs switch is recommended

⁠Pre-compiled images defaults

Pre-compiled images are built with the following default values:

Build argValue
TZEurope/Paris
PHP_EXTSintl
APK_BASEbash git vim
APK_EXTRAopenssh
COMPOSER_VERSION2.2.25

⁠Credits

Licensed under the MIT License⁠.

This project uses the awesome mlocati/docker-php-extension-installer⁠ script for PHP extensions install.

Tag summary

Content type

Image

Digest

sha256:6b13c24eb…

Size

71.6 MB

Last updated

28 days ago

docker pull yannoff/php-fpm