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-$SEMVERphp-$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 defaultAs a command runner:
docker run -v "$PWD:/app" neurony/php-8.2:latest php /app/command.php # will execute your command & exitAs a pipeline runner:
# bitbucket-pipelines.yml
- step:
image: neurony/php-8.2:qa
script:
- phpstanex.: 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-amqpphp-bcmathphp-curlphp-gdphp-grpcphp-httpphp-igbinaryphp-imagickphp-intlphp-mbstringphp-memcachedphp-mongodbphp-msgpackphp-mysqlphp-newrelicphp-odbcphp-pgsqlphp-protobufphp-raphfphp-redisphp-soapphp-sqlite3php-ssh2php-stompphp-timezonedbphp-xmlphp-xslphp-yamlphp-zipphp-zmq
Tools:
composercronnginxphp-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-phpdbgphp-xdebug-- disabled by default
...and tools:
codeceptioncomposer-require-checkercomposer-unusedenvsubstinfectionlocal-php-security-checkerparatestphpatphpcpdphpinsightsphplintphplocphpmndphpstan+ekino/phpstan-banned-code+nunomaduro/larastanphpunitpsalm+psalm/plugin-laravelpsysh-- a much improved PHP interactive shellunzipnickjj/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:
nodejsnpmnpxyarn
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-clidockerdocker-composekubectlmysqlmysqldump
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:
7zipenvsubst-- already present in base imagejq-- see https://jqlang.github.io/jq/q-- see https://harelba.github.io/q/ (only on AMD64)taryq-- see https://mikefarah.gitbook.io/yq/unzip-- already required by QA image for composerzip
Tools installed by add-debug script:
diglesslibmemcached-toolsmysql-clientnanonetcatpingredis-toolstelnetvim
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