From 8ef2d9c64e84e06e4ad92b903915ceb19dd6fdf3 Mon Sep 17 00:00:00 2001 From: Walter Oggioni Date: Tue, 25 Feb 2025 21:31:02 +0800 Subject: [PATCH] improved usability of `native` docker image --- .gitea/workflows/build.yaml | 8 +++++--- docker/Dockerfile | 9 +++++---- docker/README.md | 24 ++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 docker/README.md diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index d3178b7..32a3841 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -39,9 +39,9 @@ jobs: push: true pull: true tags: | - gitea.woggioni.net/woggioni/rbcs:latest - gitea.woggioni.net/woggioni/rbcs:${{ steps.retrieve-version.outputs.VERSION }} - target: release + gitea.woggioni.net/woggioni/rbcs:vanilla + gitea.woggioni.net/woggioni/rbcs:vanilla-${{ steps.retrieve-version.outputs.VERSION }} + target: release-vanilla cache-from: type=registry,ref=gitea.woggioni.net/woggioni/rbcs:buildx - name: Build rbcs memcache Docker image @@ -66,6 +66,8 @@ jobs: push: true pull: true tags: | + gitea.woggioni.net/woggioni/rbcs:latest + gitea.woggioni.net/woggioni/rbcs:${{ steps.retrieve-version.outputs.VERSION }} gitea.woggioni.net/woggioni/rbcs:native gitea.woggioni.net/woggioni/rbcs:native-${{ steps.retrieve-version.outputs.VERSION }} target: release-native diff --git a/docker/Dockerfile b/docker/Dockerfile index 8b35559..423b982 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,7 +3,7 @@ RUN adduser -D luser USER luser WORKDIR /home/luser -FROM base-release AS release +FROM base-release AS release-vanilla ADD rbcs-cli-envelope-*.jar rbcs.jar ENTRYPOINT ["java", "-XX:+UseSerialGC", "-XX:GCTimeRatio=24", "-jar", "/home/luser/rbcs.jar", "server"] @@ -17,6 +17,7 @@ ADD logback.xml . ENTRYPOINT ["java", "-Dlogback.configurationFile=logback.xml", "-XX:+UseSerialGC", "-XX:GCTimeRatio=24", "-jar", "/home/luser/rbcs.jar", "server"] FROM scratch AS release-native -ADD rbcs-cli.upx rbcs-cli -ENV RBCS_CONFIGURATION_DIR="." -ENTRYPOINT ["./rbcs-cli"] +ADD rbcs-cli.upx /rbcs/rbcs-cli +ENV RBCS_CONFIGURATION_DIR="/rbcs" +WORKDIR /rbcs +ENTRYPOINT ["./rbcs/rbcs-cli"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..c28ff2f --- /dev/null +++ b/docker/README.md @@ -0,0 +1,24 @@ +# RBCS Docker images +There are 3 image flavours: +- vanilla +- memcache +- native + +The `vanilla` image only contains the envelope +jar file with no plugins and is based on `eclipse-temurin:21-jre-alpine` + +The `memcache` image is similar to the `vanilla` image, except that it also contains +the `rbcs-server-memcache` plugin in the `plugins` folder, use this image if you don't want to use the `native` +image and want to use memcache as the cache backend + +The `native` image contains a native, statically-linked executable created with GraalVM +that has no userspace dependencies. It also embeds the memcache plugin inside the executable. +Use this image for maximum efficiency and minimal memory footprint. + +## Which image shoud I use? +The `native` image uses Java's SerialGC, so it's ideal for constrained environment like containers or small servers, +if you have a lot of resources and want to squeeze out the maximum throughput you should consider the +`vanilla` or `memcache` image, then choose and fine tune the garbage collector. + +Also the `native` image is only available for the `x86_64` architecture at the moment, +while `vanilla` and `memcache` also ship a `aarch64` variant.