mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Converted TYPE=FORGE to use image helper
This commit is contained in:
parent
043d9778b8
commit
6008660a81
@ -60,7 +60,7 @@ 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.9.0
|
ARG MC_HELPER_VERSION=1.9.2
|
||||||
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/v${MC_HELPER_VERSION}
|
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/v${MC_HELPER_VERSION}
|
||||||
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 - \
|
||||||
|
1
examples/.gitignore
vendored
Normal file
1
examples/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/data/
|
@ -2,15 +2,16 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mc:
|
mc:
|
||||||
image: itzg/minecraft-server:java8
|
image: itzg/minecraft-server
|
||||||
ports:
|
ports:
|
||||||
# expose the Minecraft server port outside of container
|
# expose the Minecraft server port outside of container
|
||||||
- 25565:25565
|
- "25565:25565"
|
||||||
environment:
|
environment:
|
||||||
# REQUIRED for all types
|
# REQUIRED for all types
|
||||||
EULA: "TRUE"
|
EULA: "TRUE"
|
||||||
# Set server type (vs the default of vanilla)
|
# Set server type (vs the default of vanilla)
|
||||||
TYPE: FORGE
|
TYPE: FORGE
|
||||||
|
DEBUG: "true"
|
||||||
volumes:
|
volumes:
|
||||||
# use a named, managed volume for data volume
|
# use a named, managed volume for data volume
|
||||||
- mc_forge:/data
|
- mc_forge:/data
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
: "${FORGEVERSION:=RECOMMENDED}"
|
||||||
: ${FORGEVERSION:=RECOMMENDED}
|
|
||||||
|
# shellcheck source=start-utils
|
||||||
|
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
get_installer() {
|
get_installer() {
|
||||||
@ -16,7 +18,7 @@ get_installer() {
|
|||||||
for fn in $forgeFileNames; do
|
for fn in $forgeFileNames; do
|
||||||
downloadUrl=https://maven.minecraftforge.net/net/minecraftforge/forge/$fn
|
downloadUrl=https://maven.minecraftforge.net/net/minecraftforge/forge/$fn
|
||||||
log "...trying $downloadUrl"
|
log "...trying $downloadUrl"
|
||||||
if curl -o $FORGE_INSTALLER -fsSL $downloadUrl; then
|
if get -o "$FORGE_INSTALLER" "$downloadUrl"; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -24,7 +26,7 @@ get_installer() {
|
|||||||
exit 2
|
exit 2
|
||||||
else
|
else
|
||||||
log "Downloading $FORGE_INSTALLER_URL ..."
|
log "Downloading $FORGE_INSTALLER_URL ..."
|
||||||
if ! curl -o $FORGE_INSTALLER -fsSL $FORGE_INSTALLER_URL; then
|
if ! get -o "$FORGE_INSTALLER" "$FORGE_INSTALLER_URL"; then
|
||||||
log "Failed to download from given location $FORGE_INSTALLER_URL"
|
log "Failed to download from given location $FORGE_INSTALLER_URL"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
@ -32,20 +34,19 @@ get_installer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
if [ ! -e $FORGE_INSTALLER ]; then
|
if [ ! -e "$FORGE_INSTALLER" ]; then
|
||||||
get_installer $normForgeVersion $shortForgeVersion
|
get_installer "$normForgeVersion" "$shortForgeVersion"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Installing Forge $shortForgeVersion using $FORGE_INSTALLER"
|
log "Installing Forge $shortForgeVersion using $FORGE_INSTALLER"
|
||||||
mkdir -p mods
|
mkdir -p mods
|
||||||
tries=3
|
tries=3
|
||||||
while ((--tries >= 0)); do
|
while ((--tries >= 0)); do
|
||||||
java -jar $FORGE_INSTALLER --installServer
|
if java -jar "$FORGE_INSTALLER" --installServer; then
|
||||||
if [ $? == 0 ]; then
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if (($tries < 0)); then
|
if ((tries < 0)); then
|
||||||
log "Forge failed to install after several tries." >&2
|
log "Forge failed to install after several tries." >&2
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
@ -66,7 +67,7 @@ install() {
|
|||||||
|
|
||||||
export SERVER=$latest
|
export SERVER=$latest
|
||||||
log "Using server $SERVER"
|
log "Using server $SERVER"
|
||||||
echo $SERVER > $installMarker
|
echo "$SERVER" > "$installMarker"
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_versions() {
|
resolve_versions() {
|
||||||
@ -81,15 +82,21 @@ resolve_versions() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
promosUrl=http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
|
||||||
|
|
||||||
log "Checking Forge version information."
|
log "Checking Forge version information."
|
||||||
case $FORGEVERSION in
|
case $FORGEVERSION in
|
||||||
|
LATEST)
|
||||||
|
if ! FORGE_VERSION=$(get --json-path ".promos['$VANILLA_VERSION-latest']" "$promosUrl"); then
|
||||||
|
log "ERROR: Version $VANILLA_VERSION is not supported by Forge"
|
||||||
|
log " Refer to http://files.minecraftforge.net/ for supported versions"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
RECOMMENDED)
|
RECOMMENDED)
|
||||||
curl -fsSL -o /tmp/forge.json http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
|
if ! FORGE_VERSION=$(get --json-path ".promos['$VANILLA_VERSION-recommended']" "$promosUrl"); then
|
||||||
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$VANILLA_VERSION-recommended\"]")
|
if ! FORGE_VERSION=$(get --json-path ".promos['$VANILLA_VERSION-latest']" "$promosUrl"); then
|
||||||
if [ $FORGE_VERSION = null ]; then
|
|
||||||
FORGE_VERSION=$(cat /tmp/forge.json | jq -r ".promos[\"$VANILLA_VERSION-latest\"]")
|
|
||||||
if [ $FORGE_VERSION = null ]; then
|
|
||||||
log "ERROR: Version $VANILLA_VERSION is not supported by Forge"
|
log "ERROR: Version $VANILLA_VERSION is not supported by Forge"
|
||||||
log " Refer to http://files.minecraftforge.net/ for supported versions"
|
log " Refer to http://files.minecraftforge.net/ for supported versions"
|
||||||
exit 2
|
exit 2
|
||||||
@ -122,14 +129,15 @@ resolve_versions
|
|||||||
|
|
||||||
installMarker="/data/.forge-installed-$shortForgeVersion"
|
installMarker="/data/.forge-installed-$shortForgeVersion"
|
||||||
|
|
||||||
if [ ! -e $installMarker ]; then
|
if [ ! -e "$installMarker" ]; then
|
||||||
install
|
install
|
||||||
else
|
else
|
||||||
export SERVER=$(cat $installMarker)
|
SERVER=$(cat "$installMarker")
|
||||||
|
export SERVER
|
||||||
if [ ! -e "$SERVER" ] && versionLessThan 1.17; then
|
if [ ! -e "$SERVER" ] && versionLessThan 1.17; then
|
||||||
rm "$installMarker"
|
rm "$installMarker"
|
||||||
install
|
install
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-setupWorld $@
|
exec "${SCRIPTS:-$(dirname "$0")}/start-setupWorld" "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user