Sign inSign up

kchason/precommit-php

By kchason

•Updated 9 months ago

Python/PHP container with pre-commit installed.

Image
0

1.3K

kchason/precommit-php repository overview

⁠Pre-Commit and PHP

A Python container that includes pre-commit⁠ with PHP to allow for PHP related pre-commit hooks in continuous integration (CI) environments.

⁠Dockerfile
FROM --platform=amd64 python:3.11

# Install the required packages
RUN apt -qq update && apt -qq install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2 &&\
    echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/sury-php.list &&\
    wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add - &&\
    apt -qq update && apt -qq install -y php8.1 php8.1-cli git &&\
    pip install pre-commit

# Specify the default working directory
WORKDIR /app

# Set the entrypoint to run by default
ENTRYPOINT ["pre-commit", "run", "--all-files"]
⁠Usage
⁠Command Line (Local)
docker run --rm -v $(pwd):/app kchason/precommit-php:8.1
⁠GitLab CI
PreCommit:
  stage: Lint
  allow_failure: false
  image:
    name: kchason/precommit-php:8.1
    entrypoint: [ "" ]
  script:
    - pre-commit run --all-files
  tags:
    - docker

Tag summary

Content type

Image

Digest

sha256:e3133f014…

Size

136.3 MB

Last updated

9 months ago

docker pull kchason/precommit-php