Docker image ghcr.io/kit-sdq/artemis-javabuild for the Java programming exercises on Artemis at KIT.
It contains Maven, a Temurin JDK and a pre-filled Maven repository, so the exercise builds run fully offline:
no request to Maven Central, GitLab or any other repository, not even for SNAPSHOT updates.
Warning
Rebuild this image after every deployment of the test-framework (including SNAPSHOTs). The image only contains the test-framework that was deployed when it was built. Without a rebuild, Artemis keeps using the old test-framework, and new plugin or dependency versions make all exercise builds fail.
Run the Docker Push workflow ("Run workflow" on main) or:
gh workflow run docker-publish.yml --repo kit-sdq/artemis-javabuild-container --ref main- Versions:
pom.xmlonly referencesedu.kit.kastel.sdq.artemis:test-framework-parent. All plugin and dependency versions (and the Java version) are pinned there. The exercise test repositories use the same parent, so the image caches exactly the versions the exercises need. Thepom.xmlto copy into an exercise is in the README of the test-framework. - Warm-up: the image build runs exactly the commands Artemis runs on the sample project (
assignment/src,test/,staticCodeAnalysisConfig/):This fillsmvn -B clean compile mvn -B test mvn -B spotbugs:spotbugs checkstyle:checkstyle pmd:pmd pmd:cpd/repowith all plugins and their runtime dependencies (e.g. surefire providers, SpotBugs, PMD). - Offline: afterwards the user settings
/maven-home/.m2/settings.xmlset<offline>true</offline>.MAVEN_OPTSfixesuser.hometo/maven-home, so the settings are used by every user, as Jenkins runs the container with-u <uid>:<gid>and without a home directory. (<offline>in the globalsettings.xmlwould be ignored by Maven.) - Self-check: the three commands run again offline. The image build fails if anything is missing in
/repo.
An exercise that requests a version that is not cached fails with Cannot access central (...) in offline mode instead of downloading it.
| Variable | Value |
|---|---|
MAVEN_OPTS |
-Dmaven.repo.local=/repo -Duser.home=/maven-home -Daether.remoteRepositoryFilter.prefixes=false |
RUN_IN_ARTEMIS |
true (used by the test-framework) |
- Test-framework or pinned versions changed: deploy the test-framework, update the parent version in
pom.xmlif it changed, and rebuild the image (see above). - Java version: change the base image in the
Dockerfiletogether withjava-versionintest-framework-parentand the exercises. - Dependabot only updates GitHub Actions. Maven and Docker updates are disabled on purpose, as the versions must match the test-framework and the exercises. Dependabot PRs must never be auto-merged.
- Push to
main(changes outside.github/and*.md) or a manual run of the workflow publishes:latest. - Tags
vXpublish:X.
Build the image and run an exercise like Jenkins does (non-root user, no network):
docker build -t artemis-javabuild .
docker run --rm --network none --user 12345:12345 -v "$PWD/<exercise>:/work" -w /work artemis-javabuild mvn -B test<exercise> is a test repository with the student submission in assignment/ and must be writable for that user.
With RUN_IN_ARTEMIS=true, the test-framework deletes test/protocols after a run, so use a copy of the exercise.
Caution
This repository is public. Never commit exercise material (tests, protocols, solutions, assignment sheets); .dockerignore keeps everything except the sample project out of the image.