This is an attempt to to build my own Github actions virtual environments, specifically for Java builds.
how to build
docker build -t runner-java:0.0.1-SNAPSHOT .
how to use
docker run -it --rm runner-java:0.0.1-SNAPSHOT bash
** how to build your mvn project ** mount your source code directory into a folder (-v option) and change working directory of the container into it (-w option)
docker run -it --rm -v $(pwd)/mvn-docker/settings.env1.xml:/root/.m2/settings.xml -v $(pwd)/mvn-docker/repository:/root/.m2/repository -v $(pwd):/src -w /src runner-java:0.0.1-SNAPSHOT mvn clean package
repository points to a directory in your local which can act as a reusable local repository for all your builds. You can also use a volume, or even mount ~/.m2/repository from your local maven installation.
settings.env1.xml this is a PoC of having more than one settings.xml file. For instance, each one of them can point to different distributionManagement repositories, or even different auth options.
In this example, both files are placed in a mvn-docker directorio. You can place them where ever suits you.