Updated PaperMC config

pull/3/head
Jef Roosens 2021-01-26 12:57:29 +01:00
parent 7ac4f82a85
commit 493db5690e
3 changed files with 19 additions and 65 deletions

View File

@ -1,25 +1,10 @@
# Copyright (C) 2020 Jef Roosens
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Build arguments # Build arguments
MC_VERSION= MC_VERSION=
PAPERMC_VERSION= PAPERMC_VERSION=
# Environment variables # Environment variables
XMS=4 # If XMS is left blank, it uses the same value as XMX
XMS=
XMX=4 XMX=4
# Mount points # Mount points

View File

@ -1,25 +1,16 @@
# Copyright (C) 2020 Jef Roosens FROM openjdk:11-jre-slim
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
FROM openjdk:8-slim
# Build arguments # Build arguments
ARG MC_VERSION ARG MC_VERSION
ARG PAPERMC_VERSION ARG PAPERMC_VERSION
# Install mcstatus for healthchecks
RUN apt update && \
apt install --no-install-recommends -y python3-minimal python3-setuptools python3-pip && \
python3 -m pip install mcstatus && \
apt --purge remove -y python3-pip python3-setuptools && \
apt clean
# Create worlds and config directory # Create worlds and config directory
WORKDIR /app WORKDIR /app
RUN mkdir worlds config RUN mkdir worlds config
@ -30,7 +21,6 @@ ADD "https://papermc.io/api/v1/paper/$MC_VERSION/$PAPERMC_VERSION/download" serv
# Store the cache in an anonymous volume, which means it won't get stored in the other volumes # Store the cache in an anonymous volume, which means it won't get stored in the other volumes
VOLUME /app/config/cache VOLUME /app/config/cache
WORKDIR /app/config
# Default value to keep users from eating up all ram accidentally # Default value to keep users from eating up all ram accidentally
ENV XMS=4 ENV XMS=4
@ -38,32 +28,10 @@ ENV XMS=4
# Document exposed ports # Document exposed ports
EXPOSE 25565 EXPOSE 25565
# We copy over the server jar(s) as well to make the backup more reproducible to deploy # Entrypoint runs in /app/config
ENTRYPOINT mv -n /app/*.jar /app/config && \ COPY entrypoint.sh /entrypoint.sh
echo "eula=true" > /app/config/eula.txt && \ WORKDIR /app/config
java \ ENTRYPOINT /entrypoint.sh
-Xms"${XMS}G" \
-Xmx"${XMX:-$XMS}G" \ HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
-XX:+UseG1GC \ CMD mcstatus localhost:25565 ping
-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 /app/server.jar \
--universe /app/worlds \
--nogui

View File

@ -16,7 +16,7 @@
version: '3.5' version: '3.5'
services: services:
papermc: app:
build: build:
context: . context: .
args: args:
@ -38,6 +38,7 @@ services:
- '$CONFIG_DIR:/app/config' - '$CONFIG_DIR:/app/config'
- '$WORLDS_DIR:/app/worlds' - '$WORLDS_DIR:/app/worlds'
# These volumes only get created if you use them in the env file
volumes: volumes:
config: config:
worlds: worlds: