Skip to content

Commit

Permalink
Add basic Dockerfile to compile and run a server
Browse files Browse the repository at this point in the history
  • Loading branch information
Electroid committed Apr 27, 2019
1 parent db4e7fb commit 24b11d4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM maven:3-jdk-8-alpine

# Install proper packages and setup git
RUN apk add patch --update && \
apk add --no-cache git && \
git config --global user.email "[email protected]" && \
git config --global user.name "Ashcon Partovi"

# Copy over project files into workspace
WORKDIR build
COPY . .
RUN chmod a+x scripts/*

# Generate the patches
RUN ./sportpaper rebuild

# Build the JAR
RUN ./sportpaper build

FROM openjdk:8-jre-alpine

# Copy over assets from build to the server workspace
WORKDIR server
COPY --from=0 build/SportPaper-Server/target/sportpaper*.jar sportpaper.jar
COPY sportpaper.yml .

# Install useful plugins for debugging
ADD https://ci.viaversion.com/job/ViaVersion/lastSuccessfulBuild/artifact/jar/target/ViaVersion-2.0.2-SNAPSHOT.jar plugins/viaversion.jar
ADD https://dev.bukkit.org/projects/worldedit/files/2597538/download plugins/worldedit.jar

# Run the server with recommended flags from https://mcflags.emc.gs
EXPOSE 25565
CMD java -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 -XX:+UseLargePagesInMetaspace -jar sportpaper.jar
2 changes: 1 addition & 1 deletion sportpaper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ paper:

# Duration to wait before suspending an server
# with no players online.
empty-server-suspend: PT0S
empty-server-suspend: PT1M

# Whether arrow projectiles should have a random factor.
include-randomness-in-arrow-trajectory: false
Expand Down

0 comments on commit 24b11d4

Please sign in to comment.