# The one image a match runs in: a JDK to host MegaMek, and a Python to run the # bot the host spawns as a subprocess. # # There is no JDK on the development machine here and no intention of installing # one - the sibling repos (helm/bridge, ~/.cache/mul-build) all reach for a # throwaway container instead. This is that, plus the interpreter the stub bot # needs, because the bot is a child process of the JVM and has to exist wherever # the JVM does. # # MegaMek itself is NOT in the image. It is mounted at run time from an # extracted release, so bumping MegaMek does not mean rebuilding this, and so # this repository ships none of MegaMek's CC BY-NC-SA data. FROM eclipse-temurin:21-jdk # python3 only - no pip, no venv. The bot protocol is newline JSON on a pipe and # the stub bot uses the standard library, so a dependency here would be a # dependency in every match container forever. A bot that needs more brings its # own image. # # The X11 libraries are for `sds play`, where a person sits at MegaMek's own # Swing client with the display forwarded to the host's X server. A JDK image # ships libawt_xawt.so but none of the libraries it links against, so without # these every AWT call fails with UnsatisfiedLinkError; `ldd` on that file is # the list. x11-utils is xdpyinfo, which is how `sds play --check-display` # answers "can this container reach your X server" without starting a match. # Nothing on the batch path loads any of it - that path still runs with # -Djava.awt.headless=true and never touches AWT. # # xvfb and xauth are for `one --replay`, which has no host display to borrow. # MegaMek's minimap renderer ends in ImageUtil.createAcceleratedImage(Image), # which returns null when AWT has no screen device - so every one of its image # factories hands back null under headless, having drawn the picture correctly # first. A frame buffer is the smallest thing that makes stock MegaMek code # work unmodified; the alternative was reflecting into MinimapPanel's private # drawing methods. A match without --replay still runs headless and never # starts an X server. RUN apt-get update \ && apt-get install --no-install-recommends -y \ python3 \ libx11-6 libxext6 libxrender1 libxtst6 libxi6 \ libfreetype6 fontconfig fonts-dejavu-core \ x11-utils xvfb xauth \ && rm -rf /var/lib/apt/lists/* ENV PYTHONUNBUFFERED=1 WORKDIR /work