mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Add support for Fabric server
This commit is contained in:
parent
3ddbbf41d8
commit
e751369d38
@ -76,7 +76,7 @@ ENTRYPOINT [ "/start" ]
|
|||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= LEVEL=world \
|
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
|
||||||
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true SERVER_NAME="Dedicated Server" \
|
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true SERVER_NAME="Dedicated Server" \
|
||||||
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_"
|
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_"
|
||||||
|
@ -529,6 +529,72 @@ Just change it with `SPONGEBRANCH`, such as:
|
|||||||
$ docker run -d -v /path/on/host:/data ... \
|
$ docker run -d -v /path/on/host:/data ... \
|
||||||
-e TYPE=SPONGEVANILLA -e SPONGEBRANCH=EXPERIMENTAL ...
|
-e TYPE=SPONGEVANILLA -e SPONGEBRANCH=EXPERIMENTAL ...
|
||||||
|
|
||||||
|
## Running a Fabric Server
|
||||||
|
|
||||||
|
Enable Fabric server mode by adding a `-e TYPE=FABRIC` to your command-line.
|
||||||
|
By default the container will run the latest version of [Fabric server](http://fabricmc.net/use/)
|
||||||
|
but you can also choose to run a specific version with `-e FABRICVERSION=0.5.0.32`.
|
||||||
|
|
||||||
|
$ docker run -d -v /path/on/host:/data -e VERSION=1.14.3 \
|
||||||
|
-e TYPE=FABRIC -e FABRICVERSION=0.5.0.32 \
|
||||||
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
|
To use a pre-downloaded Forge installer, place it in the attached `/data` directory and
|
||||||
|
specify the name of the installer file with `FABRIC_INSTALLER`, such as:
|
||||||
|
|
||||||
|
$ docker run -d -v /path/on/host:/data ... \
|
||||||
|
-e FABRIC_INSTALLER=fabric-installer-0.5.0.32.jar ...
|
||||||
|
|
||||||
|
To download a Forge installer from a custom location, such as your own file repository, specify
|
||||||
|
the URL with `FABRIC_INSTALLER_URL`, such as:
|
||||||
|
|
||||||
|
$ docker run -d -v /path/on/host:/data ... \
|
||||||
|
-e FORGE_INSTALLER_URL=http://HOST/fabric-installer-0.5.0.32.jar ...
|
||||||
|
|
||||||
|
In both of the cases above, there is no need for the `VERSION` or `FABRICVERSION` variables.
|
||||||
|
|
||||||
|
In order to add mods, you have two options.
|
||||||
|
|
||||||
|
### Using the /data volume
|
||||||
|
|
||||||
|
This is the easiest way if you are using a persistent `/data` mount.
|
||||||
|
|
||||||
|
To do this, you will need to attach the container's `/data` directory
|
||||||
|
(see "Attaching data directory to host filesystem”).
|
||||||
|
Then, you can add mods to the `/path/on/host/mods` folder you chose. From the example above,
|
||||||
|
the `/path/on/host` folder contents look like:
|
||||||
|
|
||||||
|
```
|
||||||
|
/path/on/host
|
||||||
|
├── mods
|
||||||
|
│ └── ... INSTALL MODS HERE ...
|
||||||
|
├── config
|
||||||
|
│ └── ... CONFIGURE MODS HERE ...
|
||||||
|
├── ops.json
|
||||||
|
├── server.properties
|
||||||
|
├── whitelist.json
|
||||||
|
└── ...
|
||||||
|
```
|
||||||
|
|
||||||
|
If you add mods while the container is running, you'll need to restart it to pick those
|
||||||
|
up:
|
||||||
|
|
||||||
|
docker stop mc
|
||||||
|
docker start mc
|
||||||
|
|
||||||
|
### Using separate mounts
|
||||||
|
|
||||||
|
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
||||||
|
or downloading a world with the `WORLD` option.
|
||||||
|
|
||||||
|
There are two additional volumes that can be mounted; `/mods` and `/config`.
|
||||||
|
Any files in either of these filesystems will be copied over to the main
|
||||||
|
`/data` filesystem before starting Minecraft.
|
||||||
|
|
||||||
|
This works well if you want to have a common set of modules in a separate
|
||||||
|
location, but still have multiple worlds with different server requirements
|
||||||
|
in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
## Running with a custom server JAR
|
## Running with a custom server JAR
|
||||||
|
|
||||||
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
|
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
|
||||||
|
@ -77,6 +77,10 @@ case "${TYPE^^}" in
|
|||||||
exec /start-deployForge $@
|
exec /start-deployForge $@
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
FABRIC)
|
||||||
|
exec /start-deployFabric $@
|
||||||
|
;;
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
FTB|CURSEFORGE)
|
||||||
exec /start-deployFTB $@
|
exec /start-deployFTB $@
|
||||||
;;
|
;;
|
||||||
|
84
minecraft-server/start-deployFabric
Normal file
84
minecraft-server/start-deployFabric
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -u
|
||||||
|
|
||||||
|
export TYPE=FABRIC
|
||||||
|
|
||||||
|
FABRIC_INSTALLER=${FABRIC_INSTALLER:-}
|
||||||
|
FABRIC_INSTALLER_URL=${FABRIC_INSTALLER_URL:-}
|
||||||
|
FABRICVERSION=${FABRICVERSION:-LATEST}
|
||||||
|
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
|
||||||
|
echo "Checking Fabric version information."
|
||||||
|
case $FABRICVERSION in
|
||||||
|
LATEST)
|
||||||
|
FABRIC_VERSION=$(python - << 'EOF'
|
||||||
|
import sys
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
from contextlib import closing
|
||||||
|
from urllib2 import urlopen
|
||||||
|
|
||||||
|
with closing(urlopen('https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml')) as resp:
|
||||||
|
xml = resp.read()
|
||||||
|
|
||||||
|
root = ET.fromstring(xml)
|
||||||
|
version = root.find('*/release').text
|
||||||
|
print version
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
FABRIC_VERSION=$FABRICVERSION
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
FABRIC_INSTALLER="/tmp/fabric-installer-$FABRIC_VERSION.jar"
|
||||||
|
|
||||||
|
elif [[ -z $FABRIC_INSTALLER ]]; then
|
||||||
|
FABRIC_INSTALLER="/tmp/fabric-installer.jar"
|
||||||
|
elif [[ ! -e $FABRIC_INSTALLER ]]; then
|
||||||
|
echo "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
installMarker=".fabric-installed-${FABRIC_VERSION:-manual}"
|
||||||
|
|
||||||
|
if [[ ! -e $installMarker ]]; then
|
||||||
|
if [[ ! -e $FABRIC_INSTALLER ]]; then
|
||||||
|
if [[ -z $FABRIC_INSTALLER_URL ]]; then
|
||||||
|
echo "Downloading $FABRIC_VERSION"
|
||||||
|
downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/$FABRIC_VERSION/fabric-installer-$FABRIC_VERSION.jar"
|
||||||
|
echo "...trying $downloadUrl"
|
||||||
|
curl -o $FABRIC_INSTALLER -fsSL $downloadUrl
|
||||||
|
else
|
||||||
|
echo "Downloading $FABRIC_INSTALLER_URL ..."
|
||||||
|
if ! curl -o $FABRIC_INSTALLER -fsSL $FABRIC_INSTALLER_URL; then
|
||||||
|
echo "Failed to download from given location $FABRIC_INSTALLER_URL"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER"
|
||||||
|
tries=3
|
||||||
|
set +e
|
||||||
|
while ((--tries >= 0)); do
|
||||||
|
java -jar $FABRIC_INSTALLER server -version $VANILLA_VERSION -downloadMinecraft
|
||||||
|
if [[ $? == 0 ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
set -e
|
||||||
|
if (($tries < 0)); then
|
||||||
|
echo "Fabric failed to install after several tries." >&2
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
export SERVER=fabric-server-launch.jar
|
||||||
|
echo "Using server $SERVER"
|
||||||
|
echo $SERVER > $installMarker
|
||||||
|
|
||||||
|
else
|
||||||
|
export SERVER=$(< $installMarker)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Contineut to Final Setup
|
||||||
|
exec /start-finalSetup01World $@
|
Loading…
Reference in New Issue
Block a user