# Docker image to run pre-commit on PHP apps/libraries Debian slim based images with common dependencies to run `pre-commit` on PHP apps/libraries: - `pre-commit` and `git` commands - common PHP packages: `php-apcu php-cli php-curl php-deepcopy php-gd php-gnupg php-imagick php-intl php-json php-ldap php-mbstring php-memcache php-mysql php-pgsql php-rrd php-xdebug php-xml php-xmlrpc php-yaml php-zip php-gmp` - common PHP tools: `composer` - common Debian packages building tools: `apt-file dpkg-dev fakeroot build-essential devscripts debhelper dh-python equivs` - common python packages: `python3-all python3-dev python3-pip python3-venv` - common tools: `sed lsb-release gnupg2 curl jq rsync wget ca-certificates openssh-client unzip` - [gitdch](https://gitea.zionetrix.net/bn8/gitdch) tool - an initialized `pre-commit` environments in `/src` according to provided `.pre-commit-config.yaml` example file. **Note:** Multiple tagged images are provided to allow test on the right Debian version you are using in your production environment. Tags are named `debianX` with `XX` corresponding to the Debian version. Currently supported Debian version: - `debian10` (Debian Buster) - `debian11` (Debian Bullseye) - `debian12` (Debian Bookworm) ## Usage To use it: ```bash docker run \ -it --rm \ -v "$(pwd)":/src -w /src \ brenard/php-pre-commit \ pre-commit run --all-files ``` **Note:** To test your project with the provided `.pre-commit-config.yaml` file, use to following command: ```bash docker run \ -it --rm \ -v "$(pwd)":/src -w /src \ -v "$(pwd)/.pre-commit-config.yaml":/src/.pre-commit-config.yaml \ brenard/php-pre-commit \ pre-commit run --all-files ``` ## Build ```bash # Need to use Dockerfile+ (https://github.com/edrevo/dockerfile-plus) export DOCKER_BUILDKIT=1 export COMPOSE_DOCKER_CLI_BUILD=1 for deb_version in 10 11 12 do docker build -t docker.io/brenard/php-pre-commit:debian${deb_version} -f Dockerfile.debian${deb_version} . done docker build -t docker.io/brenard/php-pre-commit:latest -f Dockerfile.debian${deb_version} . ``` ## Publish ```bash for deb_version in 10 11 12 do docker push docker.io/brenard/php-pre-commit:debian${deb_version} done docker push docker.io/brenard/php-pre-commit:latest ```