An up-to-date multi-arch image to easily lint git repository
10K+
A Python Docker image with pre-commit:
multiarch with support of amd64 and arm64,SBOM) changes,SBOM) attestation added using Syft,docker run -t --rm -v $(pwd):/workdir jfxs/pre-commit /bin/bash -c "pre-commit run --all-files"
The first time pre-commit runs, it will automatically download, install, and run the necessary hooks (pre-commit autoupdate) and save them in the .cache/pre-commit directory.
Don't forget to add the .cache directory to the .gitignore file.
docker run -t --rm -v $(pwd):/workdir {{.TAG}} /bin/bash -c "task --taskfile /lint.yml pre-commit DIR=/workdir"
or with task installed locally and the lint task template:
task lint:pre-commit
If the .pre-commit-config.yaml doesn't exist the following default file is created:
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
# Hooks added from sample-config
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-symlinks
- id: check-toml
- id: check-xml
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
Example of usage with Gitlab-CI:
...
gitlab-release:
image: jfxs/pre-commit
stage: lint
script:
- task --taskfile /lint.yml pre-commit DIR=$(pwd)
Docker latest tag is 4.6.1-001, 4.6, 4 and has:
| Name | Version | Type |
|---|---|---|
| git | 1:2.39.5-0+deb12u3 | deb |
| github.com/go-task/task/v3 | v3.52.0 | go-module |
| pre-commit | 4.6.1 | python |
| python | 3.14.6 | UnknownPackage |
Dockerhub Overview page has the details of the last published image.
Docker tag definition:
<pre-commit_version>-<increment>
Example: 3.6.1-001
Cosign public key:
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEa3yV6+yd/l4zh/tfT6Tx+zn0dhy3
BhFqSad1norLeKSCN2MILv4fZ9GA6ODOlJOw+7vzUvzZVr9IXnxEdjoWJw==
-----END PUBLIC KEY-----
The public key is also available online: https://gitlab.com/op_so/docker/cosign-public-key/-/raw/main/cosign.pub.
To verify an image:
cosign verify --key cosign.pub $IMAGE_URI
To verify and get the software bill of materials (SBOM) attestation:
cosign verify-attestation --key cosign.pub --type spdxjson $IMAGE_URI | jq '.payload | @base64d | fromjson | .predicate'
This program is free software: you can redistribute it and/or modify it under the terms of the MIT License (MIT). See the LICENSE for details.
Content type
Image
Digest
sha256:af3c4972d…
Size
98.7 MB
Last updated
2 months ago
docker pull jfxs/pre-commit