commit 2664947a9e19616015a45459c62e241f86b17029 Author: Geoff Bourne Date: Tue Jul 9 21:02:37 2019 -0500 Initial commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d3a1239 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +docs/* \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd1b092 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.idea/ +*.iml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a7dffd6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM debian + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + unzip \ + && apt-get clean + +RUN useradd --home-dir /data --create-home -u 1000 minecraft + +ENTRYPOINT ["/opt/bedrock-entry.sh"] + +EXPOSE 19132/udp 41587 + +COPY *.sh /opt/ + +VOLUME ["/data"] + +WORKDIR /data + +USER minecraft + +# Available versions listed at +# https://minecraft.gamepedia.com/Bedrock_Edition_1.11.0 +# https://minecraft.gamepedia.com/Bedrock_Edition_1.12.0 +ENV VERSION=1.11 diff --git a/README.md b/README.md new file mode 100644 index 0000000..0e36637 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +Containerized Minecraft Bedrock Dedicated Server with selectable version + +## Quickstart + +The following starts a Bedrock Dedicated Server running a default version and +exposing the default UDP port: + +```bash +docker run -d -e EULA=TRUE -p 19132:19132/udp itzg/minecraft-bedrock-server +``` + +## Environment Variables + +- `EULA` (no default) : must be set to `TRUE` to + accept the [Minecraft End User License Agreement](https://minecraft.net/terms) +- `VERSION` (1.11) : can be set to a specific server version or just 1.11 or 1.12 to pick + the latest known version of each + +## Exposed Ports + +- **UDP** 19132 : the Bedrock server port. + **NOTE** that you must append `/udp` when exposing the port, such as `-p 19132:19132/udp` + +## Volumes + +- `/data` : the location where the downloaded server is expanded and ran. Also contains the + configuration properties file `server.properties` + +## Connecting + +When running the container on your LAN, you can find and connect to the dedicated server +in the "LAN Games" part of the "Friends" tab, such as: + +![](docs/example-client.jpg) \ No newline at end of file diff --git a/bedrock-entry.sh b/bedrock-entry.sh new file mode 100644 index 0000000..b3bec2c --- /dev/null +++ b/bedrock-entry.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +if [[ ${EULA^^} != TRUE ]]; then + echo + echo "EULA must be set to TRUE to indicate agreement with the Minecraft End User License" + echo "See https://minecraft.net/terms" + echo + exit 1 +fi + +set -e + +if [ ! -f bedrock_server ]; then + + case ${VERSION} in + 1.11) + VERSION=1.11.4.2 + ;; + 1.12) + VERSION=1.12.0.28 + ;; + esac + + DOWNLOAD_URL=https://minecraft.azureedge.net/bin-linux/bedrock-server-${VERSION}.zip + + TMP_ZIP=/tmp/$(basename ${DOWNLOAD_URL}) + + echo "Downloading Bedrock server ${VERSION} ..." + curl -o ${TMP_ZIP} -fsSL ${DOWNLOAD_URL} + unzip -q ${TMP_ZIP} + chmod +x bedrock_server +fi + +export LD_LIBRARY_PATH=. + +echo "Starting Bedrock server..." +exec ./bedrock_server \ No newline at end of file diff --git a/docs/example-client.jpg b/docs/example-client.jpg new file mode 100644 index 0000000..2795557 Binary files /dev/null and b/docs/example-client.jpg differ