Skip to content

Latest commit

 

History

History
179 lines (136 loc) · 5.8 KB

README.md

File metadata and controls

179 lines (136 loc) · 5.8 KB

CI PHP Docker images

PHP Docker images for continuous integration and running tests. These images were created for using with Gitlab CI but should work on other platforms too.

These images are built from official PHP Docker images, and additionally include:

This repository started as a fork of TetraWeb/docker, huge thanks to them for the initial work.

Features

  • Most extensions are compiled and ready for loading with docker-php-ext-enable
  • Git client from official debian repo
  • Latest binaries of Composer, PHPUnit and PHP Code Sniffer (phpcs and phpcbf)
  • Node.js v12, v14 or v20 by default using the n Node version manager, with npm, yarn and n pre-installed
  • sendmail command via msmtp, configured as relay to localhost. Check /etc/msmtprc to setup relay server

Image Registries

Images are available on the following registries:

They are listed as stayallive/php and tagged by PHP version for both linux/amd64 & linux/arm64.

Built with Depot

PHP versions

Keep in mind that although there might be a tag available it doesn't mean the PHP version is still supported, see supported PHP versions for more information.

Node versions

Starting with the PHP 8 images the n Node version manager is installed.

Pre-cached is Node 14/20 and LTS with 14/20 set as the default (see PHP versions list which Node version is the default). To use the LTS version run n lts in for example your .gitlab-ci.yml before_script section:

before_script:
  - n lts

You can use n to install any other Node version you need, but they will be downloaded each run and will not be pre-cached inside the image.

Available extensions

Some extensions are enabled by default (compiled-in) and some you have to enable when needed.

List of compiled-in extensions (enabled by default)
  • ctype
  • curl
  • date
  • dom
  • fileinfo
  • filter
  • ftp
  • hash
  • iconv
  • json
  • libxml
  • mbstring
  • mysqlnd
  • openssl
  • pcre
  • pdo
  • pdo_sqlite
  • phar
  • posix
  • readline
  • reflection
  • session
  • simplexml
  • sodium
  • spl
  • sqlite3
  • standard
  • tokenizer
  • xml
  • xmlreader
  • xmlwriter
  • zlib

Enable the extensions below by calling docker-php-ext-enable in for example your .gitlab-ci.yml before_script section:

before_script:
  # We enable bcmath, gd and intl here for example but you
  # can enable any extension or PECL extension listed below
  - docker-php-ext-enable bcmath gd intl
Available extensions
  • bcmath
  • bz2
  • calendar
  • dba
  • exif
  • ffi
  • ftp
  • gd
  • gettext
  • gmp
  • imap
  • intl
  • ldap
  • mysqli
  • opcache
  • pcntl
  • pdo
  • pdo_dblib
  • pdo_mysql
  • pdo_pgsql
  • pgsql
  • pspell
  • shmop
  • snmp
  • soap
  • sockets
  • sysvmsg
  • sysvsem
  • sysvshm
  • tidy
  • xsl
  • zip
Available PECL extensions
  • amqp
  • igbinary
  • imagick
  • mongodb
  • redis
  • xdebug (not available for PHP 8.2 yet)

Environment variables

WITH_XDEBUG=1

Enables xdebug extension (disabled by default)

TIMEZONE=Europe/Amsterdam

Set system and php.ini timezone. You can also set timezone in .gitlab-ci.yml - check Example

COMPOSER_GITHUB=<YOUR_GITHUB_TOKEN>

Adds GitHub OAuth token for Composer which allows composer to get unlimited repositories from GitHub without blocking non-interactive mode with request for authorization.

You can obtain your token at https://github.com/settings/tokens (no scopes are required).

See: Composer documentation about GitHub API rate limits

Custom php.ini values

Easiest way is to add your php.ini directives to /usr/local/etc/php/conf.d/[anyname].ini.

Another way is to mount your local php.ini on container start like docker run ... -v /home/user/php.ini:/usr/local/php/etc/php.ini ....