Add Docker example

main
Bram 2021-07-31 15:28:26 +02:00
parent 30f51d8d2b
commit a06030332a
2 changed files with 31 additions and 0 deletions

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM openjdk:slim
COPY --from=python:3 / /
WORKDIR /usr/src/app
# Prepare Minecraft - Matrix bridge
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Prepare MC server
COPY server.jar ./
RUN java -jar server.jar --nogui
COPY . .
# Buffer Python's stdout for debugging during runtime
ENV PYTHONUNBUFFERED=1
CMD ["python", "main.py", "java", "-Xmx1024M", "-Xms1024M", "-jar", "server.jar", "nogui"]

12
start.sh Normal file
View File

@ -0,0 +1,12 @@
sudo docker run \
-p 25565:25565 \
-v "<folder in which your store your Minecraft world>":/usr/src/app/world \
-e EULA=true \
-e WHITELIST=false \
-e VERIFY_ACCOUNTS=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