phppdf Docs

A Docker image for running PHP CLI tooling against a project

Source ↗

Docs

Getting started

The image is based on php:8.4-cli and expects the project to be mounted at /app, which is also the working directory. It has no ENTRYPOINT, so it behaves like a plain PHP CLI image with Composer and a few extra tools pre-installed. It runs as a non-root user, app (UID/GID 1000), by default.

Running commands

services:
  cli:
    image: ghcr.io/phppdf/docker-image-php-cli:dev
    volumes:
      - ./:/app
docker compose run --rm cli composer install
docker compose run --rm cli vendor/bin/phpunit
docker compose run --rm cli vendor/bin/phpstan analyse

Without Compose, the same commands can be run with docker run:

docker run --rm -v ./:/app ghcr.io/phppdf/docker-image-php-cli:dev composer install

See the CLI page for more details, running as your user if your host UID differs from 1000, and the coverage page for running tests with code coverage.