Skip to content

phppdf/docker-image-php-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-image-php-cli

A Docker image for running PHP CLI tooling (Composer, PHPUnit, PHPStan, PHPCS, PHPBench, ...) against a project, without installing PHP locally.

The image expects the project to be mounted at /app. It has no entrypoint, so any command can be run directly.

Usage

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

By default the image runs as a non-root user, app (UID/GID 1000), so files created inside the container are owned by your user on the host (on most single-user Linux installations, the first user is UID/GID 1000). If your UID/GID differs, override it with docker compose run --rm --user "$(id -u):$(id -g)" cli ....

Run PHPUnit with coverage (the image includes Xdebug):

docker compose run --rm -e XDEBUG_MODE=coverage cli vendor/bin/phpunit --coverage-html .phpunit-coverage

About

A Docker image that can be used to run PHP via the CLI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors