Docker image to run pre-commit on PHP apps/libraries
Find a file
2024-04-18 14:26:30 +02:00
fake_php_project Initial version 2024-02-29 20:05:17 +01:00
.codespellrc Initial version 2024-02-29 20:05:17 +01:00
.gitignore Initial version 2024-02-29 20:05:17 +01:00
.pre-commit-config.yaml Initial version 2024-02-29 20:05:17 +01:00
.yamllint.yml Initial version 2024-02-29 20:05:17 +01:00
Dockerfile.common Initial version 2024-02-29 20:05:17 +01:00
Dockerfile.common.init Initial version 2024-02-29 20:05:17 +01:00
Dockerfile.debian10 debian10: provide a composer 2 version 2024-04-18 14:26:30 +02:00
Dockerfile.debian11 Initial version 2024-02-29 20:05:17 +01:00
Dockerfile.debian12 Initial version 2024-02-29 20:05:17 +01:00
README.md Initial version 2024-02-29 20:05:17 +01:00

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 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:

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:

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

# 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

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