Skip to main content

Building the image

Docker PHP Image uses buildah to build a compatible OCI container image.

The image is compatible to all platforms, and it is capable to run on docker, podman, kubernetes and any other compatible with the OCI specification.

Preparing the environment


  • Python 3.x
  • buildah

There is no necessary have docker installed, however you need to have the buildah on your machine.

If you are using an ubuntu/debian system you can use the provided script to install it.

Command to build

usage: [-h] [--debug] [--build-base]
[--build-cli] [--build-fpm]
[--build-fpm-apache] [--build-fpm-nginx]

You can build one image only, but you need to make sure you have the base on your machine.

The configuration file

The configuration for each environment is in the folder config and it is a yaml file like this:

# The base image to use
image: alpine:edge

# (Optional) If we are getting packages from other resources define here

# The PHP Version
major: 8
minor: 0

# List of extensions to be installed
- (NAME)
- (NAME)

# The PECL extensions to be installed
- name: xdebug # required
version: 2.5.5 # optional - if not set get the latest
install: False # optional - do not call pecl install
zend: True # optional - if true, add as zend extension
config: # optional - if set add extra config to php.ini
- xdebug.remote_port=9001 # for this extension

# Composer packages to be installed
- phpunit/phpunit:*
- squizlabs/php_codesniffer:*
- phpmd/phpmd:@stable
- phpunit
- phpcs
- phpbcbf
- phpmd

# Temporary Packages to be used to build the PECL packages
- autoconf
- build-base

# Permanent packages to be installed in the image
- libssl1.1
- libcrypto1.1


Build the images

docker run -it --privileged -v /tmp/z:/var/lib/containers -v $PWD:/work -w /work byjg/k8s-ci:latest bash
python3 ./ 8.2 --arch amd64 --build-base --debug

Check images

buildah images
buildah rmi ...