This repository contains the Dockerfiles used to build the PHP images found at https://hub.docker.com/u/neurony.
They aim to:
- be compatible with Symfony & Laravel basic requirements
- support commonly used extensions (
gd
,mysql
,redis
, etc.) - be useful in ci/cd pipelines to run tests and quality gates
- include useful PHP tools (
composer
,phpunit
,phpstan
, etc.)
We rely on the PHP package repository provided by ondrej/php PPA.
Image naming & tagging format:
(8.0 ... 8.2) YY.MM
▼ ▼
php-<PHPVS>:<role>-<semver>-<arch>
▲ ▲
base|qa|fs amd64|arm64
dumper|cloud-cli
The <semver>
value can be latest
or an incremental version number (expressed as YY.MM
).
The <arch>
can be omitted because the images are multi-arch.
There are several multi-arch aliases for php-$PHPVS:$ROLE-$SEMVER-*
php-$PHPVS:$ROLE-$SEMVER
-- the arch is selected based on your systemphp-$PHPVS:$ROLE
-- the<semver>
is assumed to belatest
For the base image there are 2 more shortcuts:
php-$PHPVS:$SEMVER
-- equivalent tophp-$PHPVS:base-$SEMVER
php-$PHPVS:latest
-- equivalent tophp-$PHPVS:base
As a server:
docker run -v "$PWD:/app" neurony/php-8.2:latest # will start nginx + php-fpm (+ crond + var-dump; if enabled)
or
# docker-compose.yml
services:
backend:
image: neurony/php-8.2:latest
ports:
- 80:80 # served by NGINX by default
As a command runner:
docker run -v "$PWD:/app" neurony/php-8.2:latest php /app/command.php # will execute your command & exit
As a pipeline runner:
# bitbucket-pipelines.yml
- step:
image: neurony/php-8.2:qa
script:
- phpstan
ex.: neurony/php-8.2
ex.: neurony/php-8.2:base
or neurony/php-8.2:base-23.11
or neurony/php-8.2:base-23.11-amd64
PHP Extensions:
php-amqp
php-bcmath
php-curl
php-gd
php-grpc
php-http
php-igbinary
php-imagick
php-intl
php-mbstring
php-memcached
php-mongodb
php-msgpack
php-mysql
php-newrelic
php-odbc
php-pgsql
php-protobuf
php-raphf
php-redis
php-soap
php-sqlite3
php-ssh2
php-stomp
php-timezonedb
php-xml
php-xsl
php-yaml
php-zip
php-zmq
Tools:
composer
cron
nginx
php-fpm
ex.: neurony/php-8.2:qa
or neurony/php-8.2:qa-23.11
or neurony/php-8.2:qa-23.11-amd64
Extends the main image with the following PHP Extensions:
php-pcov
-- disabled by defaultphp-phpdbg
php-xdebug
-- disabled by default
...and tools:
codeception
composer-require-checker
composer-unused
envsubst
infection
local-php-security-checker
paratest
phpat
phpcpd
phpinsights
phplint
phploc
phpmnd
phpstan
+ekino/phpstan-banned-code
+nunomaduro/larastan
phpunit
psalm
+psalm/plugin-laravel
psysh
-- a much improved PHP interactive shellunzip
nickjj/wait-until
ex.: neurony/php-8.2:fs
or neurony/php-8.2:fs-23.11
or neurony/php-8.2:fs-23.11-amd64
Extends the QA image with the following tools:
nodejs
npm
npx
yarn
ex.: neurony/php-8.2:dumper
or neurony/php-8.2:dumper-23.11
or neurony/php-8.2:dumper-23.11-amd64
An image with the var-dump server enabled (but NGINX & PHP-FPM disabled).
It's meant to be used in conjunction with VAR_DUMPER_FORMAT=tcp://<name-of-your-container>
to allow all of your PHP
driven containers to use dump()
and dd()
and reach the same dump server.
ex.: neurony/php-8.2:cloud-cli
or neurony/php-8.2:cloud-cli-23.11
or neurony/php-8.2:cloud-cli-23.11-amd64
An image to use in pipelines where CLI tools are useful to prepare deployments, prepare configuration, build images, etc.:
az-cli
docker
docker-compose
kubectl
mysql
mysqldump
We previously offered a dev image that contained tools for developers to debug their local environments. This is no longer an image, it's a script that can be run on any of the images when you need those tools.
Tools installed by add-config
script:
7zip
envsubst
-- already present in base imagejq
-- see https://jqlang.github.io/jq/q
-- see https://harelba.github.io/q/ (only on AMD64)tar
yq
-- see https://mikefarah.gitbook.io/yq/unzip
-- already required by QA image for composerzip
Tools installed by add-debug
script:
dig
less
libmemcached-tools
mysql-client
nano
netcat
ping
redis-tools
telnet
vim
Clone this repo, setup your preferred environment variables (there's an .env.sample file available) then run docker compose build
.
git clone [email protected]:Neurony/php-dockerfiles.git;
cd php-dockerfiles/;
cp .env.sample .env
nano .env # specify a platform architecture ($X_ARCH) and PHP version ($PHPVS)
docker compose build
# or building a specific version of PHP, with a specific version of NodeJS, and a specific timestamp
PHPVS=8.2 NODEVS=20 TS=`date +%Y%m` docker compose build
# or use the ./build script to build all images
./build
# or use the ./build script to build specific images based on your needs
./build nopush "8.0 8.2" "arm64" latest
Pull requests welcome