From 76016879cb26a14fae6e51409854450aaa8f8a0b Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sat, 2 Nov 2024 17:59:09 +0800 Subject: [PATCH] update --- .env | 4 ++++ docker-compose.yaml | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .env create mode 100644 docker-compose.yaml diff --git a/.env b/.env new file mode 100644 index 0000000..36389ea --- /dev/null +++ b/.env @@ -0,0 +1,4 @@ +MC_DIR=/root/mc/renyuan # 活动目录(主机上的路径) +MAX_MEMORY=10G # 最大内存 +MIN_MEMORY=4G # 最小内存 +JAR_FILE=./Server/Purpur-1.20.1.jar # jar 文件的路径 diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ca44761 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,16 @@ +services: + minecraft: + image: openjdk:21 + container_name: minecraft-server + working_dir: /mc-server + environment: + - MAX_MEMORY=${MAX_MEMORY} + - MIN_MEMORY=${MIN_MEMORY} + volumes: + - ${MC_DIR}:/mc-server + command: > + java -Xmx${MAX_MEMORY} -Xms${MIN_MEMORY} -jar ${JAR_FILE} nogui + ports: + - "25565:25565" + stdin_open: true + tty: true