diff --git a/.gitignore b/.gitignore index 05aa6e2c5..b0f570a19 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /*.AppImage /core* /qemu_* +/data diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ad9cd984f..000000000 --- a/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM debian:bullseye-slim - -# Install -RUN \ - apt-get update && \ - apt-get install -y tini qemu-user && \ - apt-get --fix-broken install -y && \ - rm -rf /var/lib/apt/lists/* - -# Copy -ADD ./out/server-amd64 /app - -# Setup Working Directory -RUN mkdir /data -WORKDIR /data - -# Setup Entrypoint -ENTRYPOINT ["/usr/bin/tini", "--"] -CMD ["/app/usr/bin/minecraft-pi-reborn-server"] diff --git a/Dockerfile.server b/Dockerfile.server new file mode 100644 index 000000000..66f9d08a3 --- /dev/null +++ b/Dockerfile.server @@ -0,0 +1,30 @@ +FROM debian:buster as builder +ADD . . +RUN echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/backports.list && apt-get update && apt-get install --no-install-recommends -y -t buster-backports cmake dpkg-dev wget +RUN ./scripts/install-dependencies.sh +ARG TARGETARCH +#Build +#If build fails past this stage, you're probably missing the repository submodules +RUN ./scripts/setup.sh server $TARGETARCH +RUN ./scripts/build.sh server $TARGETARCH + +FROM debian:bullseye-slim as runtime + +# Install +RUN \ + apt-get update && \ + apt-get install -y tini qemu-user && \ + apt-get --fix-broken install -y && \ + rm -rf /var/lib/apt/lists/* +ARG TARGETARCH +# Copy +COPY --from=builder ./out/server-$TARGETARCH /app + +# Setup Working Directory +RUN mkdir /data +WORKDIR /data + +EXPOSE 19132/udp +# Setup Entrypoint +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["/app/usr/bin/minecraft-pi-reborn-server"] diff --git a/compose.yml b/compose.yml new file mode 100644 index 000000000..7dc6604be --- /dev/null +++ b/compose.yml @@ -0,0 +1,23 @@ +name: minecraft-pi-reborn +services: + server: + build: + context: . + dockerfile: Dockerfile.server + image: thebrokenrail/minecraft-pi-reborn-server + networks: + default: null + ports: + - mode: ingress + target: 19132 + published: "19132" + protocol: udp + volumes: + - type: bind + source: ./data + target: /data + bind: + create_host_path: true +networks: + default: + name: minecraft-pi-reborn_default diff --git a/docs/DEDICATED_SERVER.md b/docs/DEDICATED_SERVER.md index a9242fadf..dd242b44d 100644 --- a/docs/DEDICATED_SERVER.md +++ b/docs/DEDICATED_SERVER.md @@ -9,11 +9,12 @@ This server is also compatible with MCPE Alpha v0.6.1[^1]. To use, install and run ``minecraft-pi-reborn-server``. It will generate the world and ``server.properties`` in the current directory. ### Docker Image -An official Docker image is also provided: [thebrokenrail/minecraft-pi-reborn-server](https://hub.docker.com/r/thebrokenrail/minecraft-pi-reborn-server). +~~An official Docker image is also provided: [thebrokenrail/minecraft-pi-reborn-server](https://hub.docker.com/r/thebrokenrail/minecraft-pi-reborn-server).~~ +Use the provided Dockerfile.server at the root, there's a sample compose.yml file you can use with ``docker compose`` ## Server Limitations -* Player data is not saved because of limitations with MCPE LAN worlds - * An easy workaround is to place your inventory in a chest before logging off +* Player data is not saved because of limitations with MCPE LAN worlds (This means player position and inventory are both reset) + * An easy workaround is to place your inventory in an easily reachable chest before logging off * Survival Mode servers are incompatible with unmodded MCPI [^1]: The exception to this is buckets, those will crash MCPE players.