mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 22:02:28 +00:00
Merge pull request #52 from sshipway/master
Add Spigot support, and non-zip URLs
This commit is contained in:
commit
edd69c40f6
3 changed files with 115 additions and 20 deletions
|
@ -14,7 +14,8 @@ RUN useradd -M -s /bin/false --uid 1000 minecraft \
|
||||||
&& mkdir /data \
|
&& mkdir /data \
|
||||||
&& mkdir /config \
|
&& mkdir /config \
|
||||||
&& mkdir /mods \
|
&& mkdir /mods \
|
||||||
&& chown minecraft:minecraft /data /config /mods
|
&& mkdir /plugins
|
||||||
|
&& chown minecraft:minecraft /data /config /mods /plugins
|
||||||
|
|
||||||
EXPOSE 25565
|
EXPOSE 25565
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ COPY start-minecraft.sh /start-minecraft
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
VOLUME ["/mods"]
|
VOLUME ["/mods"]
|
||||||
VOLUME ["/config"]
|
VOLUME ["/config"]
|
||||||
|
VOLUME ["/plugins"]
|
||||||
COPY server.properties /tmp/server.properties
|
COPY server.properties /tmp/server.properties
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,57 @@ 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
|
location, but still have multiple worlds with different server requirements
|
||||||
in either persistent volumes or a downloadable archive.
|
in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
|
## Running a Bukkit/Spigot server
|
||||||
|
|
||||||
|
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT -e VERSION=1.8` or `-e TYPE=SPIGOT -e VERSION=1.8` to your command-line.
|
||||||
|
|
||||||
|
The VERSION option should be set to 1.8, as this is the only version of CraftBukkit and Spigot currently
|
||||||
|
available. The latest build in this branch will be used.
|
||||||
|
|
||||||
|
$ docker run -d -v /path/on/host:/data \
|
||||||
|
-e TYPE=SPIGOT -e VERSION=1.8 \
|
||||||
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
|
You can install Bukkit plugins in two ways.
|
||||||
|
|
||||||
|
### 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 plugins to the `/path/on/host/plugins` folder you chose. From the example above,
|
||||||
|
the `/path/on/host` folder contents look like:
|
||||||
|
|
||||||
|
```
|
||||||
|
/path/on/host
|
||||||
|
├── plugins
|
||||||
|
│ └── ... INSTALL PLUGINS HERE ...
|
||||||
|
├── ops.json
|
||||||
|
├── server.properties
|
||||||
|
├── whitelist.json
|
||||||
|
└── ...
|
||||||
|
```
|
||||||
|
|
||||||
|
If you add plugins 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 is one additional volume that can be mounted; `/plugins`.
|
||||||
|
Any files in this filesystem will be copied over to the main
|
||||||
|
`/data/plugins` filesystem before starting Minecraft.
|
||||||
|
|
||||||
|
This works well if you want to have a common set of plugins in a separate
|
||||||
|
location, but still have multiple worlds with different server requirements
|
||||||
|
in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
## Using Docker Compose
|
## Using Docker Compose
|
||||||
|
|
||||||
Rather than type the server options below, the port mappings above, etc
|
Rather than type the server options below, the port mappings above, etc
|
||||||
|
|
|
@ -33,19 +33,35 @@ esac
|
||||||
|
|
||||||
cd /data
|
cd /data
|
||||||
|
|
||||||
echo "Checking minecraft / forge type information."
|
echo "Checking type information."
|
||||||
case "$TYPE" in
|
case "$TYPE" in
|
||||||
VANILLA)
|
*BUKKIT|*bukkit|SPIGOT|spigot)
|
||||||
SERVER="minecraft_server.$VANILLA_VERSION.jar"
|
TYPE=SPIGOT
|
||||||
|
case "$TYPE" in
|
||||||
|
*BUKKIT|*bukkit)
|
||||||
|
echo "Downloading latest CraftBukkit 1.8 server ..."
|
||||||
|
SERVER=craftbukkit_server.jar
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Downloading latest Spigot 1.8 server ..."
|
||||||
|
SERVER=spigot_server.jar
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case $VANILLA_VERSION in
|
||||||
|
1.8*)
|
||||||
|
URL=/spigot18/$SERVER
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "That version of $SERVER is not available."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
wget -q https://getspigot.org$URL
|
||||||
|
;;
|
||||||
|
|
||||||
if [ ! -e $SERVER ]; then
|
FORGE|forge)
|
||||||
echo "Downloading $SERVER ..."
|
|
||||||
wget -q https://s3.amazonaws.com/Minecraft.Download/versions/$VANILLA_VERSION/$SERVER
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
FORGE)
|
|
||||||
# norm := the official Minecraft version as Forge is tracking it. dropped the third part starting with 1.8
|
# norm := the official Minecraft version as Forge is tracking it. dropped the third part starting with 1.8
|
||||||
|
TYPE=FORGE
|
||||||
case $VANILLA_VERSION in
|
case $VANILLA_VERSION in
|
||||||
1.7.*)
|
1.7.*)
|
||||||
norm=$VANILLA_VERSION
|
norm=$VANILLA_VERSION
|
||||||
|
@ -56,16 +72,16 @@ case "$TYPE" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "Checking Forge version information."
|
echo "Checking Forge version information."
|
||||||
case $FORGEVERSION in
|
case $FORGEVERSION in
|
||||||
RECOMMENDED)
|
RECOMMENDED)
|
||||||
FORGE_VERSION=`wget -O - http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json | jsawk -n "out(this.promos['$norm-recommended'])"`
|
FORGE_VERSION=`wget -O - http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json | jsawk -n "out(this.promos['$norm-recommended'])"`
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
FORGE_VERSION=$FORGEVERSION
|
FORGE_VERSION=$FORGEVERSION
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# URL format changed for 1.7.10 from 10.13.2.1300
|
# URL format changed for 1.7.10 from 10.13.2.1300
|
||||||
sorted=$((echo $FORGE_VERSION; echo 10.13.2.1300) | sort -V | head -1)
|
sorted=$((echo $FORGE_VERSION; echo 10.13.2.1300) | sort -V | head -1)
|
||||||
|
@ -87,12 +103,27 @@ case "$TYPE" in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
VANILLA|vanilla)
|
||||||
|
SERVER="minecraft_server.$VANILLA_VERSION.jar"
|
||||||
|
|
||||||
|
if [ ! -e $SERVER ]; then
|
||||||
|
echo "Downloading $SERVER ..."
|
||||||
|
wget -q https://s3.amazonaws.com/Minecraft.Download/versions/$VANILLA_VERSION/$SERVER
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Invalid type: '$TYPE'"
|
||||||
|
echo "Must be: VANILLA, FORGE, SPIGOT"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# If supplied with a URL for a world, download it and unpack
|
# If supplied with a URL for a world, download it and unpack
|
||||||
if [[ "$WORLD" ]]; then
|
if [[ "$WORLD" ]]; then
|
||||||
case "X$WORLD" in
|
case "X$WORLD" in
|
||||||
X[Hh][Tt][Tt][Pp]*[Zz][iI][pP])
|
X[Hh][Tt][Tt][Pp]*)
|
||||||
echo "Downloading world via HTTP"
|
echo "Downloading world via HTTP"
|
||||||
echo "$WORLD"
|
echo "$WORLD"
|
||||||
wget -q -O - "$WORLD" > /data/world.zip
|
wget -q -O - "$WORLD" > /data/world.zip
|
||||||
|
@ -109,6 +140,12 @@ case "X$WORLD" in
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
|
# Reorganise if a Spigot server
|
||||||
|
echo "Moving End and Nether maps to Spigot location"
|
||||||
|
[ -d "/data/world/DIM1" ] && mv -f "/data/world/DIM1" "/data/world_the_end"
|
||||||
|
[ -d "/data/world/DIM-1" ] && mv -f "/data/world/DIM-1" "/data/world_nether"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
|
echo "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
|
||||||
|
@ -271,6 +308,11 @@ do
|
||||||
cp -rf "$c" /data/config
|
cp -rf "$c" /data/config
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
|
echo Copying any Bukkit plugins over
|
||||||
|
if [ -d /plugins ]; then
|
||||||
|
cp -r /plugins /data
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
exec java $JVM_OPTS -jar $SERVER
|
exec java $JVM_OPTS -jar $SERVER
|
||||||
|
|
Loading…
Reference in a new issue