Move config.py

main
Bram van den Heuvel 2023-10-01 16:41:00 +02:00
parent 5d86b17a01
commit 610c3bb01d
6 changed files with 83 additions and 71 deletions

View File

@ -7,13 +7,17 @@ WORKDIR /usr/src/app
COPY requirements.txt ./ COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Prepare MC server # # Prepare MC server
COPY server.jar ./ # COPY server.jar ./
RUN java -jar server.jar --nogui # RUN java -jar server.jar --nogui
COPY . . COPY src/ ./src/
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
CMD ["python", "main.py", "java", "-Xmx1024M", "-Xms1024M", "-jar", "server.jar", "nogui"] CMD ["python", "main.py"]

7
main.py Normal file
View File

@ -0,0 +1,7 @@
import src.mc_wrapper as mc_wrapper
import src.mxclient as matrix_client
import asyncio
# Start the Minecraft process
asyncio.run(matrix_client.start())

View File

@ -3,7 +3,7 @@
correct configuration. correct configuration.
""" """
import config import src.config as config
def write_eula(): def write_eula():
""" """

View File

@ -11,7 +11,7 @@ import asyncio
import json import json
import re import re
from src.nbsr import NonBlockingStreamReader as NBSR from src.nbsr import NonBlockingStreamReader as NBSR
import config import src.config as config
import src.build_server as build import src.build_server as build
# Write the appropriate files # Write the appropriate files

View File

@ -5,7 +5,7 @@ import re
from nio import AsyncClient, MatrixRoom, RoomMessageText from nio import AsyncClient, MatrixRoom, RoomMessageText
import src.mc_wrapper as mc_wrapper import src.mc_wrapper as mc_wrapper
import config import src.config as config
STARTUP_TIME = time.time() STARTUP_TIME = time.time()
@ -57,4 +57,5 @@ async def start():
mc_wrapper.start(client, config.MATRIX_ROOM) mc_wrapper.start(client, config.MATRIX_ROOM)
) )
if __name__ == '__main__':
asyncio.run(start()) asyncio.run(start())