Skip to content
Snippets Groups Projects

Played around

Merged Jakob Moser requested to merge played-around into master
2 files
+ 11
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 65
28
# JRE base
# Base image on OpenJDK 11 JRE
FROM openjdk:11.0-jre-slim
LABEL org.label-schema.name="clspigot-docker"
LABEL org.label-schema.description="Docker Container for an Papermc Server"
LABEL org.label-schema.vcs-url="https://gitlab.cl.uni-heidelberg.de/tmueller/clspigot-docker/"
LABEL maintainer="mueller@tobistech.ovh"
LABEL org.label-schema.schema-version=1.0
# Execute all the following instructions in the container as user "root"
USER root
ARG user=papermc
# User and group used to run the PaperMC server (build time argument, defaulting to "papermc")
ARG papermc_user=papermc
ARG papermc_group=papermc
ARG vcsref=""
LABEL org.label-schema.vcs-ref=${vcsref}
# Environment variables
# Default environment variables
# The Java Options are Aikar's flags to optimize a few things, among them garbage collection:
# https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
ENV MC_VERSION="latest" \
PAPER_BUILD="latest" \
MC_RAM="2G" \
JAVA_OPTS="-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -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"
COPY papermc.sh .
COPY backup.sh .
COPY restore.sh .
RUN apt-get update \
&& apt-get install wget curl jq webp screen cron -y \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /papermc \
&& mkdir /backup \
&& chmod +x papermc.sh \
&& chmod +x backup.sh \
&& chmod +x restore.sh
RUN groupadd -g 61000 papermc
RUN useradd -g 61000 -l -M -s /bin/false -u 61000 papermc
RUN chown -R ${user} /papermc
RUN chown -R ${user} /backup
USER papermc
# Start script
CMD ["sh", "./papermc.sh"]
# Container setup
JAVA_OPTS="-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -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" \
#Man kann nun auch die guid des eigenen benutzers passen und mus somit nichtmehr die rechte des hostsystems anpassen, bitte die GUID eines non-root users nehmen der an dem speicherort zugriff hat.
GUID=61000 \
TZ=Europe/Berlin
# Copy over the three script files (entrypoint, backup and restore)
COPY papermc.sh /
COPY backup.sh /
COPY restore.sh /
COPY health.sh /
COPY test.sh /
# Set Timezone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Create /papermc and /backup directories
RUN mkdir /papermc /backup
# Add papermc user and group, then change ownership of /papermc and /backup to this user
RUN groupadd -g ${GUID} ${papermc_group}
RUN useradd -g ${GUID} -l -M -s /bin/false -u ${GUID} ${papermc_user}
RUN chown -R ${papermc_user} /papermc
RUN chown -R ${papermc_user} /backup
# Get package lists, install needed packages, then remove the package lists again (to save space)
# "webp" is needed to generate images with better compression for the dynamic map (optional, needs further configuration in dynmap-plugin´s config file)
# "cron" is for making it possible to restart the server every day, week or soemthing similar (its optional)
# "curl" is required for getting the server initialised
# "screen" is required for getting the server running at all
RUN apt-get update && apt-get install -y \
cron \
curl \
jq \
screen \
webp \
&& rm -rf /var/lib/apt/lists/*
# Execute all following commands as the papermc user
USER $papermc_user
# Start script and also entrypoint for the container
CMD ["sh", "/papermc.sh"]
#Alle 10s testen ob exit code = 0
HEALTHCHECK --interval=10s --timeout=10s --start-period=30s \
CMD ["sh", "/health.sh"]
# Container setup, specifies needed ports. May be adjusted or overwritten if plugins need other ports
EXPOSE 25565/tcp
EXPOSE 25565/udp
#Specifies the datastructure in the container
VOLUME /papermc
VOLUME /backup
Loading