Building Container Images
When deploying BlueDragon with Kubernetes, you will need to create a container image for your Minecraft server application.
Your image must contain both the Server project and your game JARs.
Because your games compile against the Server, the recommended way to build the image is to
build the Server and publish it to the local Maven repository first, then build your games against it.
The Dockerfile below does this in two stages. It assumes your project is a Gradle project
(like the Games repository) with a copyJars task that
copies your built game JARs into build/all-jars.
# The `server` build context should point to the root of the Server project.# Build and publish the Server to the local Maven repository.FROM docker.io/library/gradle:9.5.1-jdk25 AS build-serverCOPY --from=server . /workWORKDIR /workRUN --mount=type=cache,target=/home/gradle/.gradle \ /usr/bin/gradle --console=plain --stacktrace --no-daemon check installThinDist publishToMavenLocal
# Build your games against the freshly-built Server.FROM docker.io/library/gradle:9.5.1-jdk25 AS build-gamesCOPY --from=build-server /root/.m2/repository/com/bluedragonmc /root/.m2/repository/com/bluedragonmcCOPY . /workWORKDIR /workRUN --mount=type=cache,target=/home/gradle/.gradle \ /usr/bin/gradle --console=plain --stacktrace --no-daemon build
# Assemble the final image.FROM docker.io/library/eclipse-temurin:25-jre-alpineCOPY --from=build-server /work/build/thin-dist/lib /server/libCOPY --from=build-server /work/build/thin-dist/Server-*.jar /server/server.jarCOPY --from=build-games /work/build/all-jars/*.jar /server/games/WORKDIR /serverENTRYPOINT ["java", "-cp", "/server/server.jar:/server/lib/*", "com.bluedragonmc.server.ServerKt"]Then, you can build your project and push the image to your registry:
docker build --build-context=server=../Server . -t <your registry url>/bluedragonmc/server-full:latestdocker push <your registry url>/bluedragonmc/server-full:latestFinally, you can start containers or the server Deployment using this image, which will have your games preinstalled.
