Skip to content

Run Docker image as a git hook? #1009

Description

@jenstroeger

I think somewhat related is issue #418

I’m trying to figure out how to run the prebuilt docker image ghcr.io/antonbabenko/pre-commit-terraform as a git hook using either the docker_image or system language. There seem to be multiple problems:

  1. The docker image requires a .pre-commit-config.yaml on the host and that collides with my own configuration to control the git hooks in my repo.

  2. Using prek and using two separate config files solved 1. but I’m not able to run the image because

    • the docker_image language doesn’t allow me to set --volume and --workdir, and
    • the docker_image language doesn’t execute $(id -u) to construct the USERID environment variable, and
    • the system language has the same constraints.

I also wasn’t able to correlate the repo version tags (e.g. v1.108.1) with the docker image tags shown here.

Could you please provide some guidance and documentation about how to run the docker image as a git hook on a local repo? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions