OpenCV Java 17 how to get loadLocally to work

  docker, java-native-interface, opencv, ubuntu-20.04

I have a project that uses for Java bindings. Starting with Java 12 the simple loadShared function for loading native libraries no longer works, so I have to use loadLocally. The problem is that it requires a specific version of opencv to be installed, one that is not available in Ubuntu apt. Has anyone gotten this to work? How do I install the desired version of opencv in say an ubuntu:20.04 Dockerfile?

Source: Docker Questions