Improved build and run

This commit is contained in:
Marc Baloup 2022-12-08 15:18:19 +01:00
parent 7c4cacfa07
commit eeb5f95f91
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893
3 changed files with 23 additions and 15 deletions

View File

@ -2,25 +2,22 @@ FROM eclipse-temurin:17-jdk
ARG RUNNABLE_SERVER_JAR
# create directories
WORKDIR /data
RUN mkdir jar bundle workdir
RUN mkdir bin bundle workdir
ADD $RUNNABLE_SERVER_JAR jar/paper.jar
# add executable files
ADD $RUNNABLE_SERVER_JAR bin/paper.jar
ADD run.sh bin/run.sh
RUN java -DbundlerRepoDir=/data/bundle -Dpaperclip.patchonly=true -jar /data/jar/paper.jar
# download paper libraries and apply patches
RUN java -DbundlerRepoDir=/data/bundle -Dpaperclip.patchonly=true -jar /data/bin/paper.jar
# configure max heap size
ENV MAXMEM=1024M
EXPOSE 25565
VOLUME /data/workdir
WORKDIR /data/workdir
CMD java -Xmx$MAXMEM -XX:+UseG1GC -XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions \
-XX:G1ReservePercent=15 -XX:G1NewSizePercent=20 -XX:G1MaxNewSizePercent=30 \
-XX:G1HeapRegionSize=8M -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 \
-XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 \
-XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=5 \
-DbundlerRepoDir=/data/bundle \
-jar /data/jar/paper.jar nogui
CMD ["sh", "/data/bin/run.sh"]

View File

@ -50,11 +50,11 @@ curl -o $RUNNABLE_SERVER_JAR $DOWNLOAD_REOBF
DOCKER_TAG="pandacubefr/paper:"$MC_VERSION"-"$PAPER_BUILD
echo "Building docker image with pre-downloaded and pre-patched files, with tag "$DOCKER_TAG
docker build --build-arg RUNNABLE_SERVER_JAR=$RUNNABLE_SERVER_JAR -t $DOCKER_TAG .
docker build --build-arg RUNNABLE_SERVER_JAR=$RUNNABLE_SERVER_JAR -t $DOCKER_TAG -f Dockerfile.paper .
DOCKER_IMAGE_FILE="Paper-docker-image-"$MC_VERSION"-"$PAPER_BUILD".tar.gz"
DOCKER_IMAGE_FILE="Paper-docker-"$MC_VERSION"-"$PAPER_BUILD".tar.gz"
echo "Saving docker image to "$DOCKER_IMAGE_FILE
docker save -o $DOCKER_IMAGE_FILE $DOCKER_TAG
docker save $DOCKER_TAG | gzip > $DOCKER_IMAGE_FILE
#mkdir uberjar
#for jar in `cat jars.txt`; do

11
run.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
java -Xmx$MAXMEM -XX:+UseG1GC -XX:+ParallelRefProcEnabled \
-XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions \
-XX:G1ReservePercent=15 -XX:G1NewSizePercent=20 -XX:G1MaxNewSizePercent=30 \
-XX:G1HeapRegionSize=8M -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 \
-XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 \
-XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=5 \
-DbundlerRepoDir=/data/bundle \
-jar /data/bin/paper.jar nogui