mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-08-02 05:32:16 +00:00
Use mc-image-helper to install vanilla Minecraft. (#4165)
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
This commit is contained in:
co-authored by
Geoff Bourne
parent
cd2c5628f2
commit
3c4c94e1ad
@@ -80,27 +80,27 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.16.5
|
mcVersion: 1.16.5
|
||||||
# Pin version for pre-Java 17
|
# Pin version for pre-Java 17
|
||||||
mcHelperVersion: 1.51.3-java8
|
mcHelperVersion: 1.51.4-java8
|
||||||
# JAVA 11
|
# JAVA 11
|
||||||
- variant: java11
|
- variant: java11
|
||||||
baseImage: adoptopenjdk:11-jre-hotspot
|
baseImage: adoptopenjdk:11-jre-hotspot
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.16.4
|
mcVersion: 1.16.4
|
||||||
# Pin version for pre-Java 17
|
# Pin version for pre-Java 17
|
||||||
mcHelperVersion: 1.51.3-java8
|
mcHelperVersion: 1.51.4-java8
|
||||||
# JAVA 8: NOTE: Unable to go past 8u312 because of Forge dependencies
|
# JAVA 8: NOTE: Unable to go past 8u312 because of Forge dependencies
|
||||||
- variant: java8
|
- variant: java8
|
||||||
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.12.2
|
mcVersion: 1.12.2
|
||||||
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
||||||
mcHelperVersion: 1.51.3-java8
|
mcHelperVersion: 1.51.4-java8
|
||||||
- variant: java8-jdk
|
- variant: java8-jdk
|
||||||
baseImage: eclipse-temurin:8u312-b07-jdk-focal
|
baseImage: eclipse-temurin:8u312-b07-jdk-focal
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
mcVersion: 1.12.2
|
mcVersion: 1.12.2
|
||||||
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
||||||
mcHelperVersion: 1.51.3-java8
|
mcHelperVersion: 1.51.4-java8
|
||||||
env:
|
env:
|
||||||
# Assume they line up, but when forked change to your Docker Hub username
|
# Assume they line up, but when forked change to your Docker Hub username
|
||||||
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ jobs:
|
|||||||
mcVersion: 1.20.4
|
mcVersion: 1.20.4
|
||||||
# For GLIBC_2.34 support
|
# For GLIBC_2.34 support
|
||||||
knockdRepoOrg: Metalcape/knock
|
knockdRepoOrg: Metalcape/knock
|
||||||
|
# JAVA 8:
|
||||||
- variant: java8
|
- variant: java8
|
||||||
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
@@ -54,7 +55,7 @@ jobs:
|
|||||||
# For GLIBC_2.34 support
|
# For GLIBC_2.34 support
|
||||||
knockdRepoOrg: Metalcape/knock
|
knockdRepoOrg: Metalcape/knock
|
||||||
# Pin version for Java 8, be sure to also set in build.yml
|
# Pin version for Java 8, be sure to also set in build.yml
|
||||||
mcHelperVersion: 1.51.3-java8
|
mcHelperVersion: 1.51.4-java8
|
||||||
env:
|
env:
|
||||||
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
|||||||
--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
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/mc-image-helper versioning=loose
|
# renovate: datasource=github-releases packageName=itzg/mc-image-helper versioning=loose
|
||||||
ARG MC_HELPER_VERSION=1.61.4
|
ARG MC_HELPER_VERSION=1.62.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
|
||||||
|
|||||||
+16
-40
@@ -5,52 +5,28 @@
|
|||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
resolveVersion
|
resultsFile=/data/.install-vanilla.env
|
||||||
export SERVER="minecraft_server.${VERSION// /_}.jar"
|
|
||||||
|
|
||||||
if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
args=(
|
||||||
debug "Finding version manifest for $VERSION"
|
--output-directory=/data
|
||||||
versionManifestUrl=$(get 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VERSION "$VERSION" --raw-output '[.versions[]|select(.id == $VERSION)][0].url')
|
--results-file="${resultsFile}"
|
||||||
result=$?
|
--version="${VERSION}"
|
||||||
if [ $result != 0 ]; then
|
)
|
||||||
logError "Failed to obtain version manifest URL ($result)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ "$versionManifestUrl" = "null" ]; then
|
|
||||||
logError "Couldn't find a matching manifest entry for $VERSION"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
debug "Found version manifest at $versionManifestUrl"
|
|
||||||
|
|
||||||
if ! serverDownloadUrl=$(get --json-path '$.downloads.server.url' "${versionManifestUrl}"); then
|
if isTrue "${FORCE_REDOWNLOAD}"; then
|
||||||
logError "Failed to obtain version manifest from $versionManifestUrl ($result)"
|
log "Forcing re-install of Minecraft"
|
||||||
exit 1
|
args+=(--force-reinstall)
|
||||||
elif [ "$serverDownloadUrl" = "null" ]; then
|
|
||||||
logError "There is not a server download for version $VERSION"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "Downloading $VERSION server..."
|
|
||||||
debug "Downloading server from $serverDownloadUrl"
|
|
||||||
get -o "$SERVER" "$serverDownloadUrl"
|
|
||||||
result=$?
|
|
||||||
if [ $result != 0 ]; then
|
|
||||||
logError "Failed to download server from $serverDownloadUrl ($result)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
minecraftServerJarPath=/data/minecraft_server.jar
|
|
||||||
|
|
||||||
if versionLessThan 1.6; then
|
if ! mc-image-helper install-vanilla "${args[@]}"; then
|
||||||
if ! [[ -L $minecraftServerJarPath && $minecraftServerJarPath -ef "/data/$SERVER" ]]; then
|
logError "Failed to install vanilla Minecraft version $VERSION"
|
||||||
rm -f $minecraftServerJarPath
|
exit 1
|
||||||
ln -s "/data/$SERVER" $minecraftServerJarPath
|
|
||||||
fi
|
|
||||||
SERVER=minecraft_server.jar
|
|
||||||
elif [[ -L $minecraftServerJarPath ]]; then
|
|
||||||
rm -f $minecraftServerJarPath
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
applyResultsFile "${resultsFile}"
|
||||||
|
|
||||||
|
log "Successfully setup vanilla Minecraft version $VERSION"
|
||||||
|
|
||||||
isDebugging && ls -l
|
isDebugging && ls -l
|
||||||
export FAMILY=VANILLA
|
export FAMILY=VANILLA
|
||||||
exec "$(dirname "$0")/start-setupWorld" "$@"
|
exec "$(dirname "$0")/start-setupWorld" "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user