Commit 56caec5c authored by Hiob's avatar Hiob 👹
Browse files

Update Dockerfile

parent 62cab2a6
......@@ -6,36 +6,44 @@ FROM openjdk:${JAVA_VERSION} AS build
LABEL maintainer="nefald <contact@nefald.fr>"
LABEL author="hiob <hello@hiob.fr>"
# Environment variables
ENV PAPER_VERSION="" \
PAPER_BUILD="latest" \
MEMORYSIZE="4G" \
JAVA_OPTS=""
ARG PAPER_VERSION=""
ARG PAPER_BUILD=latest
ARG PAPERSPIGOT_CI_URL=https://papermc.io/api/v1/paper/${PAPER_VERSION}/${PAPER_BUILD}/download
ENV PAPERSPIGOT_DOWNLOAD=$PAPERSPIGOT_CI_URL
RUN echo "Downloading PaperMC ${PAPER_VERSION} ${PAPER_BUILD} ....."
WORKDIR /opt/minecraft
# Add script and dependencies
ADD papermc.sh .
RUN apt-get update \
&& apt-get install -y wget \
&& apt-get install -y curl \
&& apt-get install -y jq \
&& rm -rf /var/lib/apt/lists/*
# Download paperclip
ADD ${PAPERSPIGOT_DOWNLOAD} paperclip.jar
# User
RUN useradd -ms /bin/bash minecraft && \
chown minecraft /opt/minecraft /tmp -R && \
chmod -R 755 /tmp
chown minecraft /opt/minecraft -R
USER minecraft
# Run paperclip and obtain patched jar
RUN /usr/local/openjdk-11/bin/java -jar /opt/minecraft/paperclip.jar; exit 0
# Copy built jar
RUN mv /opt/minecraft/cache/patched*.jar paperspigot.jar
########################################################
############## Running environment #####################
########################################################
FROM openjdk:11 AS runtime
# Working directory
WORKDIR /data
# Obtain runable jar from build stage
COPY --from=build /opt/minecraft/paperspigot.jar /opt/minecraft/paperspigot.jar
# Install and run rcon
ARG RCON_CLI_VERSION=1.4.7
RUN curl -o /tmp/rcon-cli.tgz https://github.com/itzg/rcon-cli/releases/download/${RCON_CLI_VERSION}/rcon-cli_${RCON_CLI_VERSION}_linux_amd64.tar.gz
ARG RCON_CLI_VERSION=1.4.8
ADD https://github.com/itzg/rcon-cli/releases/download/${RCON_CLI_VERSION}/rcon-cli_${RCON_CLI_VERSION}_linux_amd64.tar.gz /tmp/rcon-cli.tgz
RUN tar -x -C /usr/local/bin -f /tmp/rcon-cli.tgz rcon-cli && \
rm /tmp/rcon-cli.tgz
......@@ -55,5 +63,5 @@ ENV MEMORYSIZE=$memory_size
WORKDIR /data
# Start script
CMD ["sh", "./papermc.sh"]
# Entrypoint with java optimisations
ENTRYPOINT /usr/local/openjdk-11/bin/java -jar -Xms$MEMORYSIZE -Xmx$MEMORYSIZE -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=35 -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled -Dusing.aikars.flags=mcflags.emc.gs -Dcom.mojang.eula.agree=true /opt/minecraft/paperspigot.jar --nojline nogui
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment