mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
parent
11a286fe26
commit
4808507da8
15
examples/docker-compose-fabric.yml
Normal file
15
examples/docker-compose-fabric.yml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: ${IMAGE:-itzg/minecraft-server}
|
||||||
|
environment:
|
||||||
|
EULA: "true"
|
||||||
|
TYPE: FABRIC
|
||||||
|
ports:
|
||||||
|
- 25565:25565
|
||||||
|
volumes:
|
||||||
|
- fabric:/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
fabric: {}
|
@ -3,54 +3,43 @@ set -eu
|
|||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
requireVar VANILLA_VERSION
|
||||||
export TYPE=FABRIC
|
export TYPE=FABRIC
|
||||||
|
export SERVER=fabric-server-${VANILLA_VERSION}.jar
|
||||||
|
|
||||||
FABRIC_INSTALLER=${FABRIC_INSTALLER:-}
|
isDebugging && set -x
|
||||||
FABRIC_INSTALLER_URL=${FABRIC_INSTALLER_URL:-}
|
|
||||||
FABRIC_INSTALLER_VERSION=${FABRIC_INSTALLER_VERSION:-${FABRICVERSION:-LATEST}}
|
if [[ ! -e ${SERVER} ]]; then
|
||||||
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
|
|
||||||
log "Checking Fabric version information."
|
: ${FABRIC_INSTALLER:=}
|
||||||
case $FABRIC_INSTALLER_VERSION in
|
: ${FABRIC_INSTALLER_URL:=}
|
||||||
LATEST)
|
: ${FABRIC_INSTALLER_VERSION:=${FABRICVERSION:-LATEST}}
|
||||||
|
|
||||||
|
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
|
||||||
|
log "Checking Fabric version information."
|
||||||
|
if [[ ${FABRIC_INSTALLER_VERSION^^} = LATEST ]]; then
|
||||||
FABRIC_INSTALLER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
|
FABRIC_INSTALLER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
|
|
||||||
FABRIC_INSTALLER="/tmp/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
|
FABRIC_INSTALLER="fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
|
||||||
markerVersion=$FABRIC_INSTALLER_VERSION
|
FABRIC_INSTALLER_URL="https://maven.fabricmc.net/net/fabricmc/fabric-installer/${FABRIC_INSTALLER_VERSION}/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
|
||||||
|
elif [[ -z $FABRIC_INSTALLER ]]; then
|
||||||
|
FABRIC_INSTALLER="fabric-installer.jar"
|
||||||
|
elif [[ ! -e $FABRIC_INSTALLER ]]; then
|
||||||
|
log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
elif [[ -z $FABRIC_INSTALLER ]]; then
|
|
||||||
FABRIC_INSTALLER="/tmp/fabric-installer.jar"
|
|
||||||
markerVersion=custom
|
|
||||||
elif [[ ! -e $FABRIC_INSTALLER ]]; then
|
|
||||||
log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${markerVersion}"
|
|
||||||
|
|
||||||
debug Checking for installMarker ${installMarker}
|
|
||||||
if [[ ! -e $installMarker ]]; then
|
|
||||||
if [[ ! -e $FABRIC_INSTALLER ]]; then
|
if [[ ! -e $FABRIC_INSTALLER ]]; then
|
||||||
if [[ -z $FABRIC_INSTALLER_URL ]]; then
|
log "Downloading $FABRIC_INSTALLER_URL ..."
|
||||||
log "Downloading installer version $FABRIC_INSTALLER_VERSION"
|
if ! curl -o $FABRIC_INSTALLER -fsSL $FABRIC_INSTALLER_URL; then
|
||||||
downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/${FABRIC_INSTALLER_VERSION}/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
|
log "Failed to download from given location $FABRIC_INSTALLER_URL"
|
||||||
log "...trying $downloadUrl"
|
exit 2
|
||||||
curl -o $FABRIC_INSTALLER -fsSL $downloadUrl
|
|
||||||
else
|
|
||||||
log "Downloading $FABRIC_INSTALLER_URL ..."
|
|
||||||
if ! curl -o $FABRIC_INSTALLER -fsSL $FABRIC_INSTALLER_URL; then
|
|
||||||
log "Failed to download from given location $FABRIC_INSTALLER_URL"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if isDebugging; then
|
log "Installing Fabric ${VANILLA_VERSION} using $FABRIC_INSTALLER"
|
||||||
debug "Installing Fabric ${VANILLA_VERSION} using $FABRIC_INSTALLER"
|
|
||||||
else
|
|
||||||
log "Installing Fabric using $FABRIC_INSTALLER"
|
|
||||||
fi
|
|
||||||
tries=3
|
tries=3
|
||||||
set +e
|
set +e
|
||||||
while ((--tries >= 0)); do
|
while ((--tries >= 0)); do
|
||||||
@ -67,13 +56,9 @@ if [[ ! -e $installMarker ]]; then
|
|||||||
log "Fabric failed to install after several tries." >&2
|
log "Fabric failed to install after several tries." >&2
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
export SERVER=fabric-server-launch.jar
|
|
||||||
log "Using server $SERVER"
|
|
||||||
echo $SERVER > $installMarker
|
|
||||||
|
|
||||||
else
|
mv fabric-server-launch.jar ${SERVER}
|
||||||
export SERVER=$(< $installMarker)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Contineut to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
Loading…
Reference in New Issue
Block a user