Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated scripts as per phusion/baseimage documentation #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
4 changes: 4 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# we execute the startup script as the 'bedrock' user.
exec /sbin/setuser bedrock /home/bedrock/startup.sh
9 changes: 6 additions & 3 deletions startup.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/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

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
Expand All @@ -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
Expand All @@ -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/