This commit is contained in:
Zengtudor 2024-12-29 13:15:43 +08:00
parent 74217cdffe
commit 1424239952

View File

@ -4,24 +4,13 @@ services:
container_name: minecraft-server
working_dir: /mc-server
environment:
- MAX_MEMORY=5G # 设置最大内存为 10GB
- MIN_MEMORY=5G # 将最小内存也设置为 10GB确保不会低于该值
- MAX_MEMORY=5G
- MIN_MEMORY=5G
- TZ=Asia/Shanghai
volumes:
- ${MC_DIR}:/mc-server
command: >
java -Xms${MIN_MEMORY} -Xmx${MAX_MEMORY} -XX:MaxRAM=5G
-XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m
-XX:MaxDirectMemorySize=2G
-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200
-XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC
-XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40
-XX:G1HeapRegionSize=8M -XX:G1ReservePercent=15 -XX:G1HeapWastePercent=5
-XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15
-XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5
-XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1
-Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true
-jar ${JAR_FILE} nogui
java -Xms${MIN_MEMORY} -Xmx${MAX_MEMORY} -jar ${JAR_FILE} nogui
ports:
- "25565:25565"
stdin_open: true