Set server.properties from environment variables
Allow for server version upgrades
This commit is contained in:
1 parent
2fd816f7a8
commit
8480be99f6
4 files changed
+130
-8
No files matched your search
+11
-4
@@ -1,5 +1,7 @@
|
||||
FROM debian
|
||||
|
||||
ARG ARCH=amd64
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
curl \
|
||||
@@ -15,14 +17,19 @@ WORKDIR /data
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint-demoter", "--match", "/data", "--debug", "--stdin-on-term", "stop", "/opt/bedrock-entry.sh"]
|
||||
|
||||
ARG DEMOTER_VERSION=0.2.0
|
||||
ARG DEMOTER_ARCH=amd64
|
||||
ADD https://github.com/itzg/entrypoint-demoter/releases/download/${DEMOTER_VERSION}/entrypoint-demoter_${DEMOTER_VERSION}_Linux_${ARCH}.tar.gz /tmp/
|
||||
RUN cd /usr/local/bin ; tar xvf /tmp/entrypoint-demoter_${DEMOTER_VERSION}_Linux_${ARCH}.tar.gz entrypoint-demoter && \
|
||||
rm /tmp/entrypoint-demoter_${DEMOTER_VERSION}_Linux_${ARCH}.tar.gz
|
||||
|
||||
ADD https://github.com/itzg/entrypoint-demoter/releases/download/${DEMOTER_VERSION}/entrypoint-demoter_${DEMOTER_VERSION}_linux_${DEMOTER_ARCH}.deb /usr/src
|
||||
|
||||
RUN dpkg -i /usr/src/entrypoint-demoter_${DEMOTER_VERSION}_linux_${DEMOTER_ARCH}.deb
|
||||
ARG SET_PROPERTY_VERSION=0.1.1
|
||||
ADD https://github.com/itzg/set-property/releases/download/${SET_PROPERTY_VERSION}/set-property_${SET_PROPERTY_VERSION}_linux_${ARCH}.tar.gz /tmp/
|
||||
RUN cd /usr/local/bin ; tar xvf /tmp/set-property_${SET_PROPERTY_VERSION}_linux_${ARCH}.tar.gz set-property && \
|
||||
rm /tmp/set-property_${SET_PROPERTY_VERSION}_linux_${ARCH}.tar.gz
|
||||
|
||||
COPY *.sh /opt/
|
||||
|
||||
COPY property-definitions.json /etc/bds-property-definitions.json
|
||||
|
||||
# Available versions listed at
|
||||
# https://minecraft.gamepedia.com/Bedrock_Edition_1.11.0
|
||||
# https://minecraft.gamepedia.com/Bedrock_Edition_1.12.0
|
||||
|
||||
@@ -20,6 +20,8 @@ For Minecraft Java Edition you'll need to use this image instead:
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### Container Specific
|
||||
|
||||
- `EULA` (no default) : must be set to `TRUE` to
|
||||
accept the [Minecraft End User License Agreement](https://minecraft.net/terms)
|
||||
- `VERSION` (1.12) : can be set to a specific server version or just 1.11 or 1.12 to pick
|
||||
@@ -29,6 +31,36 @@ For Minecraft Java Edition you'll need to use this image instead:
|
||||
- `GID` (default derived from `/data` owner) : can be set to a specific group ID to run the
|
||||
bedrock server process
|
||||
|
||||
### Server Properties
|
||||
|
||||
The following environment variables will set the equivalent property in `server.properties`, where each [is described here](https://minecraft.gamepedia.com/Server.properties#Bedrock_Edition_3).
|
||||
|
||||
- `SERVER_NAME`
|
||||
- `GAMEMODE`
|
||||
- `DIFFICULTY`
|
||||
- `LEVEL_TYPE`
|
||||
- `ALLOW_CHEATS`
|
||||
- `MAX_PLAYERS`
|
||||
- `ONLINE_MODE`
|
||||
- `WHITE_LIST`
|
||||
- `VIEW_DISTANCE`
|
||||
- `TICK_DISTANCE`
|
||||
- `PLAYER_IDLE_TIMEOUT`
|
||||
- `MAX_THREADS`
|
||||
- `LEVEL_NAME`
|
||||
- `LEVEL_SEED`
|
||||
- `DEFAULT_PLAYER_PERMISSION_LEVEL`
|
||||
- `TEXTUREPACK_REQUIRED`
|
||||
|
||||
For example, to configure a flat, creative server instead of the default use:
|
||||
|
||||
```bash
|
||||
docker run -d --name bds-flat-creative \
|
||||
-e EULA=TRUE -e LEVEL_TYPE=flat -e GAMEMODE=creative \
|
||||
-p 19132:19132/udp itzg/minecraft-bedrock-server
|
||||
```
|
||||
|
||||
|
||||
## Exposed Ports
|
||||
|
||||
- **UDP** 19132 : the Bedrock server port.
|
||||
|
||||
+13
-4
@@ -10,8 +10,6 @@ fi
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -f bedrock_server ]; then
|
||||
|
||||
case ${VERSION} in
|
||||
1.11)
|
||||
VERSION=1.11.4.2
|
||||
@@ -21,17 +19,28 @@ if [ ! -f bedrock_server ]; then
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -f bedrock_server-${VERSION} ]; then
|
||||
|
||||
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}
|
||||
|
||||
# remove only binaries to allow for an upgrade of those
|
||||
rm -f bedrock_server *.so 2> /dev/null
|
||||
# ... use -n to avoid overwriting any existing files with the archive's copy
|
||||
unzip -n -q ${TMP_ZIP}
|
||||
rm ${TMP_ZIP}
|
||||
|
||||
chmod +x bedrock_server
|
||||
mv bedrock_server bedrock_server-${VERSION}
|
||||
fi
|
||||
|
||||
set-property --file server.properties --bulk /etc/bds-property-definitions.json
|
||||
|
||||
export LD_LIBRARY_PATH=.
|
||||
|
||||
echo "Starting Bedrock server..."
|
||||
exec ./bedrock_server
|
||||
exec ./bedrock_server-${VERSION}
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"server-name": {
|
||||
"env": "SERVER_NAME"
|
||||
},
|
||||
"gamemode": {
|
||||
"env": "GAMEMODE",
|
||||
"allowed": ["survival","creative","adventure"],
|
||||
"mappings": {
|
||||
"0": "survival",
|
||||
"1": "creative",
|
||||
"2": "adventure"
|
||||
}
|
||||
},
|
||||
"difficulty": {
|
||||
"env": "DIFFICULTY",
|
||||
"allowed": ["easy","peaceful","normal","hard"],
|
||||
"mappings": {
|
||||
"0": "peaceful",
|
||||
"1": "easy",
|
||||
"2": "normal",
|
||||
"3": "hard"
|
||||
}
|
||||
},
|
||||
"level-type": {
|
||||
"env": "LEVEL_TYPE",
|
||||
"allowed": ["DEFAULT","FLAT","LEGACY"],
|
||||
"mappings": {
|
||||
"flat": "FLAT",
|
||||
"legacy": "LEGACY",
|
||||
"default": "DEFAULT"
|
||||
}
|
||||
},
|
||||
"allow-cheats": {
|
||||
"env": "ALLOW_CHEATS",
|
||||
"allowed": ["true","false"]
|
||||
},
|
||||
"max-players": {
|
||||
"env": "MAX_PLAYERS"
|
||||
},
|
||||
"online-mode": {
|
||||
"env": "ONLINE_MODE",
|
||||
"allowed": ["true","false"]
|
||||
},
|
||||
"white-list": {
|
||||
"env": "WHITE_LIST",
|
||||
"allowed": ["true","false"]
|
||||
},
|
||||
"view-distance": {
|
||||
"env": "VIEW_DISTANCE"
|
||||
},
|
||||
"tick-distance": {
|
||||
"env": "TICK_DISTANCE"
|
||||
},
|
||||
"player-idle-timeout": {
|
||||
"env": "PLAYER_IDLE_TIMEOUT"
|
||||
},
|
||||
"max-threads": {
|
||||
"env": "MAX_THREADS"
|
||||
},
|
||||
"level-name": {
|
||||
"env": "LEVEL_NAME"
|
||||
},
|
||||
"level-seed": {
|
||||
"env": "LEVEL_SEED"
|
||||
},
|
||||
"default-player-permission-level": {
|
||||
"env": "DEFAULT_PLAYER_PERMISSION_LEVEL",
|
||||
"allowed": ["visitor","member","operator"]
|
||||
},
|
||||
"texturepack-required": {
|
||||
"env": "TEXTUREPACK_REQUIRED",
|
||||
"allowed": ["true","false"]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user