Recreate Docker instructions

main
Bram van den Heuvel 2023-10-01 16:53:35 +02:00
parent 21dd275379
commit b3ab94ef78
2 changed files with 26 additions and 18 deletions

View File

@ -14,9 +14,6 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY src/ ./src/ COPY src/ ./src/
COPY main.py ./ COPY main.py ./
COPY LICENSE.md ./
COPY config.yaml ./
# Buffer Python's stdout for debugging during runtime # Buffer Python's stdout for debugging during runtime
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1

View File

@ -6,25 +6,36 @@ This way, communication is enabled between a Minecraft server and a Matrix room.
## Setup ## Setup
To create a Docker image, go to this folder and run the following command: 1. Create a Docker image using the following command:
``` ```
docker build -t matrix-mc-server ./ docker build -t matrix-mc-server ./
``` ```
Then, once a Docker image has been created, you can run the following command to run a Minecraft server. In `config.py`, you can find additional environment variables you can insert to alter settings on the Minecraft server. 2. Download the [latest Minecraft server jar file](https://www.minecraft.net/en-us/download/server).
``` 3. Open `config.yaml` and adjust it to however you like.
docker run --name mc-server \
-p 25565:25565 \
-v "<folder in which your store your Minecraft world>":/usr/src/app/world \
-e EULA=true \
-e MATRIX_HOMESERVER='<your matrix homeserver>' \
-e MATRIX_USERNAME='<matrix bridge client username>' \
-e MATRIX_PASSWORD='<matrix bridge client password>' \
-e MC_CHANNEL='<channel in which you communicate>' \
-e SERVER_ADDRESS='<ip address where players can connect to the server>' \
mc-bridge
```
This should successfully launch your bridged Minecraft server. **NOTE:** Make sure to set EULA to `true` otherwise the server will refuse to start.
4. Start the Docker container. You will need a few volumes:
- `/usr/src/app/config.yaml` - Location of your custom `config.yaml`
- `/usr/src/app/whitelist.json` - Location of your whitelist, if any.
- `/usr/src/app/world/` - Folder of your custom Minecraft world to load
- `/usr/src/app/server.jar` - (Default) location of the server jar file. Can be changed in `config.yaml`.
For example, your Docker compose file could look like the following:
```docker-compose
version: '3'
services:
matrix-mc-server:
image: matrix-mc-server:latest
volumes:
- <your config>:/usr/src/app/config.yaml
- <your whitelist>:/usr/src/app/whitelist.json
- <your world folder>:/usr/src/app/world
- <your server jar file>:/usr/src/app/server.jar
```