mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Added support for Modrinth modpacks as a server type (#2128)
This commit is contained in:
parent
a34d315d63
commit
54f310e50f
@ -46,8 +46,10 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
|||||||
--var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \
|
--var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \
|
||||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
ARG MC_HELPER_VERSION=1.27.9
|
ARG MC_HELPER_VERSION=1.28.2
|
||||||
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
|
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
|
||||||
|
# used for cache busting local copy of mc-image-helper
|
||||||
|
ARG MC_HELPER_REV=1
|
||||||
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
|
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
|
||||||
| tar -C /usr/share -zxf - \
|
| tar -C /usr/share -zxf - \
|
||||||
&& ln -s /usr/share/mc-image-helper-${MC_HELPER_VERSION}/bin/mc-image-helper /usr/bin
|
&& ln -s /usr/share/mc-image-helper-${MC_HELPER_VERSION}/bin/mc-image-helper /usr/bin
|
||||||
|
22
README.md
22
README.md
@ -593,6 +593,28 @@ Configuration options with defaults:
|
|||||||
|
|
||||||
Crucible is only available for 1.7.10, so be sure to set `VERSION=1.7.10`.
|
Crucible is only available for 1.7.10, so be sure to set `VERSION=1.7.10`.
|
||||||
|
|
||||||
|
## Running a server with a Modrinth modpack
|
||||||
|
|
||||||
|
[Modrinth Modpacks](https://modrinth.com/modpacks) can automatically be installed along with the required mod loader (Forge or Fabric) by setting `TYPE` to "MODRINTH". Upgrading (and downgrading) takes care of cleaning up old files and upgrading (and downgrading) the mod loader.
|
||||||
|
|
||||||
|
The desired modpack project is specified with the `MODRINTH_PROJECT` environment variable and must be one of:
|
||||||
|
|
||||||
|
- The project "slug", which is located in the URL shown here:
|
||||||
|
|
||||||
|
![](docs/modrinth-project-slug.drawio.png)
|
||||||
|
- The project ID, which is located in the bottom of the left panel, shown here
|
||||||
|
|
||||||
|
![](docs/modrinth-project-id.drawio.png)
|
||||||
|
- The project page URL, such as <https://modrinth.com/modpack/cobblemon-fabric>. As described below, this can further be the page URL of a modpack's version page.
|
||||||
|
|
||||||
|
By default, the latest available version of the Modrinth modpack is selected based upon the value of `MODRINTH_DEFAULT_VERSION_TYPE`, which defaults to "release". Other valid values are "beta" and "alpha".
|
||||||
|
|
||||||
|
The selected version can also be narrowed by a few means: If wanting to use a particular mod loader, set `MODRINTH_LOADER` to either "forge" or "fabric" (Quilt support is coming soon). Since the overall `VERSION` gets dictated by the modpack, a specific modpack Minecraft version can be specified by setting `MODRINTH_MC_VERSION` to a valid version, such as "1.19.2".
|
||||||
|
|
||||||
|
A specific version of modpack file can be specified by passing the version's page URL to `MODRINTH_PROJECT`, such as <https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2> or by setting `MODRINTH_VERSION_ID` to the version ID located in the Metadata section, as shown here
|
||||||
|
|
||||||
|
![](docs/modrinth-version-id.drawio.png)
|
||||||
|
|
||||||
## Running a server with a Feed the Beast modpack
|
## Running a server with a Feed the Beast modpack
|
||||||
|
|
||||||
> **NOTE** requires one of the Ubuntu with Hotspot images listed in [the Java versions section](#running-minecraft-server-on-different-java-version).
|
> **NOTE** requires one of the Ubuntu with Hotspot images listed in [the Java versions section](#running-minecraft-server-on-different-java-version).
|
||||||
|
BIN
docs/modrinth-project-id.drawio.png
Normal file
BIN
docs/modrinth-project-id.drawio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
docs/modrinth-project-slug.drawio.png
Normal file
BIN
docs/modrinth-project-slug.drawio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
docs/modrinth-version-id.drawio.png
Normal file
BIN
docs/modrinth-version-id.drawio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 126 KiB |
20
examples/docker-compose-modrinth-modpack.yml
Normal file
20
examples/docker-compose-modrinth-modpack.yml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
tty: true
|
||||||
|
stdin_open: true
|
||||||
|
ports:
|
||||||
|
- "25565:25565"
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
TYPE: MODRINTH
|
||||||
|
MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2
|
||||||
|
# or could be https://modrinth.com/modpack/cobblemon-fabric for auto-upgrading to latest
|
||||||
|
# or just cobblemon-fabric or 5FFgwNNP
|
||||||
|
# and could replace version URL with
|
||||||
|
# MODRINTH_VERSION_ID: nvrqJg44
|
||||||
|
volumes:
|
||||||
|
# attach the relative directory 'data' to the container's /data path
|
||||||
|
- ./data:/data
|
@ -208,6 +208,10 @@ case "${TYPE^^}" in
|
|||||||
exec "${SCRIPTS:-/}start-deployAutoCF" "$@"
|
exec "${SCRIPTS:-/}start-deployAutoCF" "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
MODRINTH)
|
||||||
|
exec "${SCRIPTS:-/}start-deployModrinth" "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
VANILLA)
|
VANILLA)
|
||||||
exec "${SCRIPTS:-/}start-deployVanilla" "$@"
|
exec "${SCRIPTS:-/}start-deployVanilla" "$@"
|
||||||
;;
|
;;
|
||||||
|
50
scripts/start-deployModrinth
Normal file
50
scripts/start-deployModrinth
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# shellcheck source=start-utils
|
||||||
|
. "${SCRIPTS:-/}start-utils"
|
||||||
|
|
||||||
|
resultsFile=/data/.install-modrinth.env
|
||||||
|
|
||||||
|
requireVar MODRINTH_PROJECT
|
||||||
|
: "${MODRINTH_MC_VERSION:=}"
|
||||||
|
: "${MODRINTH_LOADER:=}"
|
||||||
|
: "${MODRINTH_VERSION_ID:=}"
|
||||||
|
: "${MODRINTH_DEFAULT_VERSION_TYPE:=release}"
|
||||||
|
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
args=(
|
||||||
|
--results-file="$resultsFile"
|
||||||
|
--project="${MODRINTH_PROJECT}"
|
||||||
|
--output-directory=/data
|
||||||
|
)
|
||||||
|
|
||||||
|
setArg() {
|
||||||
|
arg="${1?}"
|
||||||
|
var="${2?}"
|
||||||
|
|
||||||
|
if [[ ${!var} ]]; then
|
||||||
|
args+=("${arg}=${!var}")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
setArg --game-version MODRINTH_MC_VERSION
|
||||||
|
setArg --loader MODRINTH_LOADER
|
||||||
|
setArg --version-id MODRINTH_VERSION_ID
|
||||||
|
setArg --default-version-type MODRINTH_DEFAULT_VERSION_TYPE
|
||||||
|
|
||||||
|
if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then
|
||||||
|
log "ERROR failed to install Modrinth modpack"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# grab SERVER, FAMILY and export it
|
||||||
|
set -a
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "${resultsFile}"
|
||||||
|
set +a
|
||||||
|
# grab the version resolved from modpack
|
||||||
|
VANILLA_VERSION="$VERSION"
|
||||||
|
export VANILLA_VERSION
|
||||||
|
|
||||||
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
Loading…
Reference in New Issue
Block a user