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