54 lines
1.8 KiB
Docker
54 lines
1.8 KiB
Docker
FROM openjdk:8-jre
|
|
|
|
# This argument should be set when building
|
|
ARG VERSION
|
|
ARG JAR_URL="https://maven.fabricmc.net/net/fabricmc/fabric-installer/$VERSION/fabric-installer-$VERSION.jar"
|
|
|
|
WORKDIR /mc
|
|
|
|
# Download installer jar
|
|
ADD "https://maven.fabricmc.net/net/fabricmc/fabric-installer/$VERSION/fabric-installer-$VERSION.jar" fabric-installer.jar
|
|
|
|
# Install fabric, sign eula & remove installer
|
|
RUN java -jar fabric-installer.jar server -downloadMinecraft && \
|
|
rm fabric-installer.jar && \
|
|
echo "eula=true" > eula.txt
|
|
|
|
# Store the cache in an anonymous volume, which means it won't get stored in the other volumes
|
|
VOLUME /mc/config/cache
|
|
|
|
# Default value to keep users from eating up all ram accidentally
|
|
ENV XMS=4
|
|
|
|
WORKDIR /mc/config
|
|
# Source for flags:
|
|
# https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
|
|
# Certain flags auto-scale if XMS is greater than 12 (see link for info)
|
|
ENTRYPOINT mv -n /mc/*.jar /mc/config && java \
|
|
-Xms"${XMS}G" \
|
|
-Xmx"${XMX:-$XMS}G" \
|
|
-XX:+UseG1GC \
|
|
-XX:+ParallelRefProcEnabled \
|
|
-XX:MaxGCPauseMillis=200 \
|
|
-XX:+UnlockExperimentalVMOptions \
|
|
-XX:+DisableExplicitGC \
|
|
-XX:+AlwaysPreTouch \
|
|
-XX:G1NewSizePercent="$([ $XMS -gt 12 ] && echo 40 || echo 30)" \
|
|
-XX:G1MaxNewSizePercent="$([ $XMS -gt 12 ] && echo 50 || echo 40)" \
|
|
-XX:G1HeapRegionSize="$([ $XMS -gt 12 ] && echo 16 || echo 8)"M \
|
|
-XX:G1ReservePercent="$([ $XMS -gt 12 ] && echo 15 || echo 20)" \
|
|
-XX:G1HeapWastePercent=5 \
|
|
-XX:G1MixedGCCountTarget=4 \
|
|
-XX:InitiatingHeapOccupancyPercent="$([ $XMS -gt 12 ] && echo 20 || echo 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 fabric-server-launch.jar \
|
|
--universe /mc/worlds \
|
|
--nogui
|
|
|