From a6e5d3981159b54d61075b3546a81812eff9e7a6 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Wed, 30 Dec 2020 12:53:37 +0100 Subject: [PATCH] Added papermc; updated fabric files --- fabric/Dockerfile | 26 ++++++++++---------- fabric/docker-compose.yml | 8 +++--- papermc/Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++ papermc/docker-compose.yml | 23 ++++++++++++++++++ 4 files changed, 90 insertions(+), 17 deletions(-) create mode 100644 papermc/Dockerfile create mode 100644 papermc/docker-compose.yml diff --git a/fabric/Dockerfile b/fabric/Dockerfile index e693280..ef609f9 100644 --- a/fabric/Dockerfile +++ b/fabric/Dockerfile @@ -1,30 +1,31 @@ -FROM openjdk:8-jre +FROM openjdk:8-slim -# 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" +# Build arguments +ARG FABRIC_VERSION +# Create worlds and config directory WORKDIR /mc +RUN mkdir worlds config # Download installer jar -ADD "https://maven.fabricmc.net/net/fabricmc/fabric-installer/$VERSION/fabric-installer-$VERSION.jar" fabric-installer.jar +ADD "https://maven.fabricmc.net/net/fabricmc/fabric-installer/$FABRIC_VERSION/fabric-installer-$FABRIC_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 +rm fabric-installer.jar # Store the cache in an anonymous volume, which means it won't get stored in the other volumes VOLUME /mc/config/cache +WORKDIR /mc/config + # 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 \ +# We copy over the server jar(s) as well to make the backup more reproducible to deploy +ENTRYPOINT mv -n /mc/*.jar /mc/config && \ +echo "eula=true" > /mc/config/eula.txt && \ +java \ -Xms"${XMS}G" \ -Xmx"${XMX:-$XMS}G" \ -XX:+UseG1GC \ @@ -50,4 +51,3 @@ ENTRYPOINT mv -n /mc/*.jar /mc/config && java \ -jar fabric-server-launch.jar \ --universe /mc/worlds \ --nogui - diff --git a/fabric/docker-compose.yml b/fabric/docker-compose.yml index a6a34ee..9b0d81b 100644 --- a/fabric/docker-compose.yml +++ b/fabric/docker-compose.yml @@ -4,7 +4,7 @@ services: build: context: . args: - - 'VERSION=0.6.1.51' + - 'FABRIC_VERSION=0.6.1.51' image: 'mc-fabric-server:latest' restart: 'unless-stopped' @@ -17,6 +17,6 @@ services: ports: - '25565:25565' volumes: - - '/data/config:/mc/config' - - '/data/mods:/mc/config/mods' - - '/data/worlds:/mc/worlds' + - '/data/mc/fabric/config:/mc/config' + - '/data/mc/fabric/mods:/mc/config/mods' + - '/data/mc/fabric/worlds:/mc/worlds' diff --git a/papermc/Dockerfile b/papermc/Dockerfile new file mode 100644 index 0000000..522f179 --- /dev/null +++ b/papermc/Dockerfile @@ -0,0 +1,50 @@ +FROM openjdk:8-slim + +# Build arguments +ARG MC_VERSION +ARG PAPERMC_VERSION + +# Create worlds and config directory +WORKDIR /mc +RUN mkdir worlds config + +# Download server file +ADD "https://papermc.io/api/v1/paper/$MC_VERSION/$PAPERMC_VERSION/download" server.jar + +# Store the cache in an anonymous volume, which means it won't get stored in the other volumes +VOLUME /mc/config/cache + +WORKDIR /mc/config + +# Default value to keep users from eating up all ram accidentally +ENV XMS=4 + +# We copy over the server jar(s) as well to make the backup more reproducible to deploy +ENTRYPOINT mv -n /mc/*.jar /mc/config && \ +echo "eula=true" > /mc/config/eula.txt && \ +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 /mc/server.jar \ +--universe /mc/worlds \ +--nogui diff --git a/papermc/docker-compose.yml b/papermc/docker-compose.yml new file mode 100644 index 0000000..dc2d796 --- /dev/null +++ b/papermc/docker-compose.yml @@ -0,0 +1,23 @@ +version: "3.5" +services: + papermc: + build: + context: . + dockerfile: Dockerfile + args: + - 'MC_VERSION=' + - 'PAPERMC_VERSION=' + image: 'mc-papermc-server:latest' + + restart: unless-stopped + stdin_open: true + tty: true + + environment: + - XMS=4 + - XMX=4 + ports: + - '25565:25565' + volumes: + - '/data/mc/papermc/worlds:/minecraft/worlds' + - '/data/mc/papermc/config:/minecraft/config'