Skip to content

A set of highly configurable PHP-FPM images based on PHP Alpine version, enriched with composer

License

Notifications You must be signed in to change notification settings

yannoff/docker-php-fpm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yannoff/docker-php-fpm

Home for yannoff/php-fpm dockerhub repository sources.

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

Available tags

(1) Those PHP versions have now reached their EOL.
This means they are not officially supported anymore by the PHP Group.

Installed extensions & packages

By default, each image is bundled with the following extensions:

  • bcmath
  • intl
  • opcache
  • pdo_mysql
  • pdo_pgsql

and the base APK packages:

  • vim
  • git
  • bash

Building a custom image, using the apposite build arguments, allows a full-control over the installed extensions and let install extra APK packages on-demand.

Usage

Several ways to use the compiled images:

Run standalone...

docker run -d --rm --name fpm7 -v /var/www/html:/var/www/html -p 9000:9001 yannoff/php-fpm:7.3

See the apposite docker reference for details on docker run options.

...or in a docker stack

# docker-compose.yaml
fpm:
    image: yannoff/php-fpm:7.3
    # Here the exposed port on host machine is left unset,
    # letting docker allocate it automatically to a free available port
    ports:
        - 9000
    volumes:
        - /your/web/document/root:/www
    working_dir: /www 

See the docker compose reference for details on the docker-compose.yaml file syntax and options.

Building custom images

Build arguments

The following build arguments are available:

Build arg Description
PHP_EXTS PHP extensions to be installed at build time (2)
APK_ADD Extra apk packages to be installed at build time

(2) See the mlocati/docker-php-extension-installer repository for the full list of supported extensions.

Examples

There are 2 different methods to build the image:

The shortest way

Build directly using the repository URL:

Build from the command line...

Use case: PHP version 7.3 with imap extension only

$ docker build -t php73 --build-arg PHP_EXTS=imap git@github.com:yannoff/docker-php-fpm.git#:7.3
...or in a docker compose file

Use case: PHP version 8.0 with gd and imap extensions, PLUS tzdata extra APK package install

# docker-compose.yaml
fpm:
    build:
        context: https://github.com/yannoff/docker-php-fpm.git#:8.0
        args:
            PHP_EXTS: gd imap
            APK_ADD: tzdata

The classic way

Use case: PHP version 7.1 with gd and imap extensions

  1. Clone this repository or fetch a zipball.
  2. Build the image from the working directory
$ docker build -t customimage:7.1 --build-arg PHP_EXTS='gd imap' 7.1/

Credits

Licensed under the MIT License.

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

About

A set of highly configurable PHP-FPM images based on PHP Alpine version, enriched with composer

Topics

Resources

License

Stars

Watchers

Forks