feat(minecraft-server): onbuild trigger for downloading plugins and mods (#267)

* feat(minecraft-server): add onbuild trigger

Added a ONBUILD trigger for the [ToF-BuildTools](https://git.faldoria.de/tof/server/build-tools).
If a plugins.yml is provided the BuildTools will download all plugins configured in the YAML.

https://github.com/itzg/dockerfiles/issues/218

* feat(minecraft-server): add arg for build output

* fix(minecraft-server): syntax error in Dockerfile

* fix(minecraft-server): chown jar files after building

* feat(minecraft-server): cleanup buildtools after using

* fix(minecraft-server): remove /plugins volume

The /plugins volume causes weird behaviour when prepolulating it with
files on build. Removing it as an explicit volume fixes that.

* mc: add example Dockerfile for ToF builds

* docs(minecraft-server): add docs for new onbuild trigger

* fix(minecraft-server): use correct url for build tools download
This commit is contained in:
Silthus 2018-12-16 19:00:36 +01:00 committed by Geoff Bourne
parent cc83007cea
commit 52d4cae74d
4 changed files with 43 additions and 5 deletions

View File

@ -45,10 +45,22 @@ ADD https://github.com/itzg/mc-server-runner/releases/download/${MC_SERVER_RUNNE
RUN tar -x -C /usr/local/bin -f /tmp/mc-server-runner.tgz mc-server-runner && \
rm /tmp/mc-server-runner.tgz
ADD https://git.faldoria.de/tof/server/build-tools/-/jobs/artifacts/master/raw/target/ToF-BuildTools.jar?job=deploy /tmp/tof-buildtools/BuildTools.jar
ONBUILD ARG BUILDTOOLS_OUTPUT=/plugins
ONBUILD COPY Dockerfile *plugins.yml /tmp/tof-buildtools/
ONBUILD RUN java -jar /tmp/tof-buildtools/BuildTools.jar \
--config "/tmp/tof-buildtools/plugins.yml" \
--configs "plugins.yml" \
--dir "/tmp/tof-buildtools/" \
--output ${BUILDTOOLS_OUTPUT} && \
chown -R minecraft:minecraft ${BUILDTOOLS_OUTPUT} && \
rm -fR /tmp/tof-buildtools/
COPY mcadmin.jq /usr/share
RUN chmod +x /usr/local/bin/*
VOLUME ["/data","/mods","/config","/plugins"]
VOLUME ["/data","/mods","/config"]
COPY server.properties /tmp/server.properties
WORKDIR /data
@ -61,3 +73,4 @@ ENV UID=1000 GID=1000 \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true
COPY start* /
RUN dos2unix /start* && chmod +x /start*

View File

@ -263,6 +263,15 @@ 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.
### Building an image with plugins
You can also create your own Docker images by extending the `itzg/minecraft-server` image.
The image contains an `ONBUILD` trigger that will copy a `plugins.yml` file from you build directory and download any plugins specified in it.
You can read about the [`ToF-BuildTools` and how to use them here](https://git.faldoria.de/tof/server/build-tools).
You can also find [an example](examples/ToF-build/) with a custom image in the examples dir.
## Running a PaperSpigot server
Enable PaperSpigot server mode by adding a `-e TYPE=PAPER -e VERSION=1.9.4` to your command-line.

View File

@ -0,0 +1,3 @@
FROM itzg/minecraft-server
ENV TYPE=SPIGOT

View File

@ -0,0 +1,13 @@
plugins:
worldedit:
file: WorldEdit.jar
url: https://dev.bukkit.org/projects/worldedit/files/latest
FastAsyncWorldEdit:
file: FastAsyncWorldEdit.jar
url: https://empcraft.com/fawe/latest.php?bukkit
worldguard:
file: WorldGuard.jar
url: https://dev.bukkit.org/projects/worldguard/files/latest
citizens:
file: Citizens.jar
url: https://dev.bukkit.org/projects/citizens/files/latest