This commit is contained in:
Zengtudor 2025-04-20 20:25:13 +08:00
parent 8a26c2e302
commit 2ea68bacc1
3 changed files with 25 additions and 1 deletions

2
mc_folia/.env Normal file
View File

@ -0,0 +1,2 @@
MC_DIR=./data # 活动目录(主机上的路径)
JAR_FILE=./folia.jar # jar 文件的路径

View File

@ -0,0 +1,21 @@
services:
minecraft:
# image: openjdk:17-jdk-slim # 使用 JRE 版本的镜像
image: azul/zulu-openjdk:17-jre-headless
container_name: minecraft-server
working_dir: /mc-server
environment:
- TZ=Asia/Shanghai
volumes:
- ${MC_DIR}:/mc-server
command: >
java -Xms18G -Xmx18G -jar ${JAR_FILE} nogui
ports:
- "25565:25565"
stdin_open: true
tty: true
restart: always
# mem_limit: 10G # 设置容器的内存限制为 10GB
# memswap_limit: 10G # 禁止使用 swap并确保总内存不超过 10GB
# oom_score_adj: -1000
stop_grace_period: 120s # 设置关闭宽限期为 120 秒

View File

@ -1,7 +1,7 @@
services:
minecraft:
# image: openjdk:17-jdk-slim # 使用 JRE 版本的镜像
image: azul/zulu-openjdk:17-jre-headless
image: azul/zulu-openjdk:21.0.7-21.42-jre-headless
container_name: minecraft-server
working_dir: /mc-server
environment:
@ -12,6 +12,7 @@ services:
java -Xms18G -Xmx18G -jar ${JAR_FILE} nogui
ports:
- "25565:25565"
- "8100:8100"
stdin_open: true
tty: true
restart: always