From 7cdb7d398cd38bafc66e962f6585f7bf20af8165 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 2 Feb 2025 13:47:03 -0700 Subject: [PATCH] Add support for Cleanroom (Forge fork) installer (#3291) --- Dockerfile | 2 +- .../types-and-platforms/server-types/forge.md | 28 +++++++++++++++++++ examples/cleanroom/compose.yml | 15 ++++++++++ scripts/start-deployForge | 14 ++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 examples/cleanroom/compose.yml diff --git a/Dockerfile b/Dockerfile index 651bffb34a6..6729a0e580d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \ --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz -ARG MC_HELPER_VERSION=1.40.11 +ARG MC_HELPER_VERSION=1.40.12 ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION} # used for cache busting local copy of mc-image-helper ARG MC_HELPER_REV=1 diff --git a/docs/types-and-platforms/server-types/forge.md b/docs/types-and-platforms/server-types/forge.md index 58ee93ad639..f4f0f015893 100644 --- a/docs/types-and-platforms/server-types/forge.md +++ b/docs/types-and-platforms/server-types/forge.md @@ -1,5 +1,13 @@ A [Forge server](http://www.minecraftforge.net/) can be automatically downloaded, upgraded, and run by setting the environment variable `TYPE` to "FORGE". +!!! note "A note from the installer" + + > Please do not automate the download and installation of Forge. + Our efforts are supported by ads from the download page. + If you MUST automate this, please consider supporting the project through + + Since my project also relies on donations, please pass it along and consider contributing to the Patreon above. + !!! example ``` @@ -14,6 +22,7 @@ A [Forge server](http://www.minecraftforge.net/) can be automatically downloaded The overall version is specified by `VERSION`, [as described in the section above](../../versions/minecraft.md) and provides the same benefits of upgrading as new versions are released. By default, the recommended version of Forge for that Minecraft version will be selected. The latest version can be selected instead by setting the environment variable `FORGE_VERSION` to "latest". You can also choose a specific Forge version by setting `FORGE_VERSION` with that version, such as "14.23.5.2854". + !!! example ``` @@ -55,3 +64,22 @@ Support for [NeoForge](https://neoforged.net/) is also provided. A NeoForge serv VERSION: "1.20.4" NEOFORGE_VERSION: "beta" ``` + +### Cleanroom + +[Cleanroom](https://github.com/CleanroomMC/Cleanroom) isn't fully automated, but can be utilized by... + +1. choose the desired release at https://github.com/CleanroomMC/Cleanroom/releases +2. grab the link to the `*-installer.jar` file in that release +3. with `TYPE` set to "FORGE", set `FORGE_INSTALLER_URL` to the installer jar's link + +!!! example + + In docker compose `environment` + + ```yaml + TYPE: FORGE + FORGE_INSTALLER_URL: https://github.com/CleanroomMC/Cleanroom/releases/download/0.2.4-alpha/cleanroom-0.2.4-alpha-installer.jar + ``` + + [Full example](https://github.com/itzg/docker-minecraft-server/tree/master/examples/cleanroom) \ No newline at end of file diff --git a/examples/cleanroom/compose.yml b/examples/cleanroom/compose.yml new file mode 100644 index 00000000000..8c4c803e742 --- /dev/null +++ b/examples/cleanroom/compose.yml @@ -0,0 +1,15 @@ +# Provides an example of running CleanroomMC from https://github.com/CleanroomMC/Cleanroom, +# which is a Forge fork +services: + mc: + image: itzg/minecraft-server + environment: + EULA: true + TYPE: FORGE + FORGE_INSTALLER_URL: https://github.com/CleanroomMC/Cleanroom/releases/download/0.2.4-alpha/cleanroom-0.2.4-alpha-installer.jar + ports: + - "25565:25565" + volumes: + - mc-data:/data +volumes: + mc-data: \ No newline at end of file diff --git a/scripts/start-deployForge b/scripts/start-deployForge index db74fc1089d..9cecf869b76 100755 --- a/scripts/start-deployForge +++ b/scripts/start-deployForge @@ -21,6 +21,20 @@ if [[ ${FORGE_INSTALLER} ]]; then logError "Failed to installForge given installer ${FORGE_INSTALLER}" exit 1 fi +elif [[ ${FORGE_INSTALLER_URL:-} ]]; then + mkdir -p tmp + if ! installer=$(get -o tmp --output-filename "${FORGE_INSTALLER_URL}"); then + logError "Failed to download installer from $FORGE_INSTALLER_URL" + exit 1 + fi + + # shellcheck disable=SC2064 + trap "rm $installer" EXIT + + if ! mc-image-helper-forge --forge-installer="${installer}" ; then + logError "Failed to install forge from ${FORGE_INSTALLER_URL}" + exit 1 + fi else if ! mc-image-helper-forge --forge-version="${FORGE_VERSION}"; then logError "Failed to install Forge"