Skip to content

Commit

Permalink
Add better startup flags
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Apr 16, 2024
1 parent 14f1969 commit d8a576f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ COPY --from=soulfire-builder --chown=soulfire:soulfire /soulfire/dedicated/build
# Use the soulfire's home directory as our work directory
WORKDIR /soulfire

# Copy over the start script
COPY start.sh /soulfire/start.sh

# Make executable
RUN chmod +x /soulfire/start.sh

# Switch from root to soulfire
USER soulfire

EXPOSE 38765/tcp

# Start the process using dumb-init
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/opt/java/openjdk/bin/java", "-jar", "/soulfire/soulfire.jar"]
CMD ["/bin/sh", "/soulfire/start.sh"]
9 changes: 9 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if [ -z "$SF_RAM" ]; then
echo "SF_RAM is not set. Defaulting to 2G."
SF_RAM="2G"
fi

echo "Starting SoulFire dedicated server..."
java -Xmx$SF_RAM -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M -jar /soulfire/soulfire.jar

0 comments on commit d8a576f

Please sign in to comment.