From f3a5d4b5ef12b8a237c1c9c528a02b0a794f01b1 Mon Sep 17 00:00:00 2001 From: Ross Knudsen Date: Mon, 24 Jun 2019 15:23:33 +1200 Subject: [PATCH 1/2] Updated Bedrock Server to version 1.11.4. --- README.md | 2 +- docker-compose.yml | 2 +- startup.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1e3f295..09d6039 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This docker image downloads and runs the Bedrock Dedicated Server at runtime. ### Update for newer Bedrock Server version -When Mojang update the Bedrock Dedicated Server to a new version (current version 1.9.0) update the `docker-compose.yml` file to point to the new URI and change the tag number in the image node to reflect the new version. +When Mojang update the Bedrock Dedicated Server to a new version (current version 1.11.4) update the `docker-compose.yml` file to point to the new URI and change the tag number in the image node to reflect the new version. ### Modify server settings diff --git a/docker-compose.yml b/docker-compose.yml index 6705c2f..939c577 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '3' services: bedrock_server: - image: bedrock_server:1.9.0 + image: bedrock_server:1.11.4 build: . container_name: bedrock_server ports: diff --git a/startup.sh b/startup.sh index eee70e0..1f64a1f 100644 --- a/startup.sh +++ b/startup.sh @@ -1,7 +1,7 @@ #!/bin/bash # Update this as the file changes. Please be sure to agree to the EULA -BEDROCK_DOWNLOAD_ZIP=https://minecraft.azureedge.net/bin-linux/bedrock-server-1.9.0.15.zip +BEDROCK_DOWNLOAD_ZIP=https://minecraft.azureedge.net/bin-linux/bedrock-server-1.11.4.2.zip ZIPFILE=$(basename $BEDROCK_DOWNLOAD_ZIP) cd /home/bedrock/bedrock_server From f00fc3c076e576d4660c090af72fb3926e1ece6c Mon Sep 17 00:00:00 2001 From: Ross Knudsen Date: Fri, 28 Jun 2019 21:05:27 +1200 Subject: [PATCH 2/2] Updated setup code to run server as daemon as recommended by phusion/baseimage documentation. --- Dockerfile | 12 +++++------- docker-compose.yml | 3 --- run.sh | 4 ++++ startup.sh | 7 +++++-- 4 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile index bcf29cc..d0ba954 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,9 +12,12 @@ CMD ["/sbin/my_init"] RUN apt-get update \ && apt-get -y install unzip libcurl4 curl nano \ && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && useradd -ms /bin/bash bedrock \ + && mkdir /etc/service/bedrock -RUN useradd -ms /bin/bash bedrock +COPY run.sh /etc/service/bedrock/run +RUN chmod +x /etc/service/bedrock/run WORKDIR /home/bedrock @@ -26,12 +29,7 @@ RUN chmod +x startup.sh \ && mkdir -p bedrock_server/config \ && chown -R bedrock:bedrock . -# If you enable the USER below, there will be permission issues with shared volumes -USER bedrock - # create volumes for settings that need to be persisted. VOLUME /home/bedrock/bedrock_server/worlds /home/bedrock/bedrock_server/config EXPOSE 19132/udp 19133/udp - -ENTRYPOINT /home/bedrock/startup.sh diff --git a/docker-compose.yml b/docker-compose.yml index 939c577..9e19ffd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,3 @@ services: # mounting this volume in Windows at least the bedrock server crashes. - ./data/worlds:/home/bedrock/bedrock_server/import/worlds - ./data/config:/home/bedrock/bedrock_server/config - - # override the default entrypoint to include access to a bash terminal for debugging. - entrypoint: bash -c "/home/bedrock/startup.sh && /bin/bash" diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..c0f71ee --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# we execute the startup script as the 'bedrock' user. +exec /sbin/setuser bedrock /home/bedrock/startup.sh diff --git a/startup.sh b/startup.sh index 1f64a1f..b257018 100644 --- a/startup.sh +++ b/startup.sh @@ -7,7 +7,7 @@ ZIPFILE=$(basename $BEDROCK_DOWNLOAD_ZIP) cd /home/bedrock/bedrock_server if [ ! -f $ZIPFILE ]; then - echo "Downloading file" + echo "Downloading Bedrock Server code" # Download and if successful, unzip (don't allow overwrites) curl --fail -O $BEDROCK_DOWNLOAD_ZIP && unzip -n -q $ZIPFILE @@ -28,8 +28,11 @@ function copy_config() { cp $filename.defaults $filename cp $filename.defaults config/$filename fi + + # TODO we need to adjust the copied file permissions as required. } +echo "Copying config and world data" copy_config server.properties copy_config ops.json copy_config whitelist.json @@ -47,5 +50,5 @@ else echo "Server software not downloaded or unpacked!" fi -# let's copy the resulting world data back out +echo "Copying world data back out" cp -r -u worlds/* import/worlds/