feat: add a Java Runtime Environment to pre-commit image
We are looking to add Java pre-commit hooks to some repos (https://gitlab.developers.cam.ac.uk/uis/devops/hr/hr-general/-/issues/29) and, unsurprisingly, the Java-ecosystem linters are written in Java. The pre-commit image currently has no JRE installed in it but alpine packages one and so adding one is easy enough.
While we're here, bump the Python image version used for pre-commit v4
and provide a default for the PYTHON_VERSION
build arg to squash a
Docker build warning. Keep pre-commit v3 as is because that image should
only be being used by older, possibly sparsely maintained, CI jobs and
we don't want to switch the Python version out from under them.
A test pipeline showing these images building is at https://gitlab.developers.cam.ac.uk/uis/devops/infra/dockerimages/-/pipelines/644752.
A test pipeline showing a Java-based pre-commit hook running (albeit while wanting to make changes) is at https://gitlab.developers.cam.ac.uk/uis/devops/experiments/kh816-tests/kh816-maven-template-no-deploy-with-tokens/-/jobs/1875672.