mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-10-07 04:47:12 +00:00
Add VERSION_FROM_MODRINTH_PROJECTS (#3580)
This commit is contained in:
1 parent
02640e5414
commit
c2071e5038
4 files changed
+45
-1
No files matched your search
+1
-1
@@ -48,7 +48,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
|||||||
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
|
--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
|
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
ARG MC_HELPER_VERSION=1.47.3
|
ARG MC_HELPER_VERSION=1.48.0
|
||||||
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
|
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
|
# used for cache busting local copy of mc-image-helper
|
||||||
ARG MC_HELPER_REV=1
|
ARG MC_HELPER_REV=1
|
||||||
|
|||||||
@@ -42,6 +42,25 @@
|
|||||||
datapack:terralith
|
datapack:terralith
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Version from Projects
|
||||||
|
|
||||||
|
When the environment variable `VERSION_FROM_MODRINTH_PROJECTS` is set to "true" the Minecraft [`VERSION`](../versions/minecraft.md) will be automatically determined by looking at the most recent version of Minecraft that is supported by all the projects provided in `MODRINTH_PROJECTS`.
|
||||||
|
|
||||||
|
!!! example
|
||||||
|
|
||||||
|
Given the environment variables
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
MODRINTH_PROJECTS: |
|
||||||
|
viaversion
|
||||||
|
viabackwards
|
||||||
|
griefprevention
|
||||||
|
discordsrv
|
||||||
|
VERSION_FROM_MODRINTH_PROJECTS: true
|
||||||
|
```
|
||||||
|
|
||||||
|
Let's say all are supported on Minecraft up to 1.21.8 except griefprevention, which is only supported up to 1.21.7. In that case, `VERSION` will be automatically set to 1.21.7.
|
||||||
|
|
||||||
## Extra options
|
## Extra options
|
||||||
|
|
||||||
`MODRINTH_DOWNLOAD_DEPENDENCIES`
|
`MODRINTH_DOWNLOAD_DEPENDENCIES`
|
||||||
@@ -52,3 +71,4 @@
|
|||||||
|
|
||||||
`MODRINTH_LOADER`
|
`MODRINTH_LOADER`
|
||||||
: When using a custom server, set this to specify which loader type will be requested during lookups
|
: When using a custom server, set this to specify which loader type will be requested during lookups
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
environment:
|
||||||
|
EULA: true
|
||||||
|
TYPE: paper
|
||||||
|
MODRINTH_PROJECTS: |
|
||||||
|
viaversion
|
||||||
|
viabackwards
|
||||||
|
griefprevention
|
||||||
|
discordsrv
|
||||||
|
VERSION_FROM_MODRINTH_PROJECTS: true
|
||||||
|
SETUP_ONLY: true
|
||||||
|
ports:
|
||||||
|
- "25565:25565"
|
||||||
@@ -139,6 +139,15 @@ cd /data || exit 1
|
|||||||
export DECLARED_TYPE=${TYPE^^}
|
export DECLARED_TYPE=${TYPE^^}
|
||||||
export DECLARED_VERSION="$VERSION"
|
export DECLARED_VERSION="$VERSION"
|
||||||
|
|
||||||
|
if isTrue "${VERSION_FROM_MODRINTH_PROJECTS:-}" && [[ ${MODRINTH_PROJECTS:-} ]]; then
|
||||||
|
if ! VERSION=$(mc-image-helper version-from-modrinth-projects --projects "${MODRINTH_PROJECTS}"); then
|
||||||
|
logError "failed to resolve version from MODRINTH_PROJECTS: ${MODRINTH_PROJECTS}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
log "Resolved Minecraft version $VERSION from Modrinth projects"
|
||||||
|
export VERSION
|
||||||
|
fi
|
||||||
|
|
||||||
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
||||||
"${SCRIPTS:-/}start-autopause"
|
"${SCRIPTS:-/}start-autopause"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user