Moved minecraft to own folder
This commit is contained in:
parent
fc003b3cbb
commit
1a6a5d9665
13 changed files with 1 additions and 1 deletions
31
minecraft/forge/.env.example
Normal file
31
minecraft/forge/.env.example
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright (C) 2020 Jef Roosens
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Build arguments
|
||||
MC_VERSION=
|
||||
FORGE_VERSION=
|
||||
|
||||
# Environment variables
|
||||
XMS=4
|
||||
XMX=4
|
||||
|
||||
# Mount points
|
||||
CONFIG_DIR=
|
||||
MODS_DIR=
|
||||
WORLDS_DIR=
|
||||
|
||||
# Other
|
||||
PORT=25565
|
||||
73
minecraft/forge/Dockerfile
Normal file
73
minecraft/forge/Dockerfile
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# Copyright (C) 2020 Jef Roosens
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
FROM openjdk:8-slim
|
||||
|
||||
# Build arguments
|
||||
ARG MC_VERSION
|
||||
ARG FORGE_VERSION
|
||||
|
||||
# Create worlds and config directory
|
||||
WORKDIR /mc
|
||||
RUN mkdir worlds config
|
||||
|
||||
# Download installer jar
|
||||
ADD "https://files.minecraftforge.net/maven/net/minecraftforge/forge/${MC_VERSION}-${FORGE_VERSION}/forge-${MC_VERSION}-${FORGE_VERSION}-installer.jar" installer.jar
|
||||
|
||||
# Install forge & remove installer
|
||||
RUN java -jar installer.jar server --installServer && \
|
||||
rm installer.jar installer.jar.log
|
||||
|
||||
# Forge doesn't use one single name, so this is needed to know the name of the executable
|
||||
ENV FORGE_JAR="forge-${MC_VERSION}-${FORGE_VERSION}.jar"
|
||||
|
||||
# Store the cache in an anonymous volume, which means it won't get stored in the other volumes
|
||||
VOLUME /mc/config/cache
|
||||
|
||||
WORKDIR /mc/config
|
||||
|
||||
# Default value to keep users from eating up all ram accidentally
|
||||
ENV XMS=4
|
||||
|
||||
# We copy over the server jar(s) as well to make the backup more reproducible to deploy
|
||||
ENTRYPOINT mv -n /mc/*.jar /mc/*.json /mc/libraries /mc/config && \
|
||||
echo "eula=true" > /mc/config/eula.txt && \
|
||||
java \
|
||||
-Xms"${XMS}G" \
|
||||
-Xmx"${XMX:-$XMS}G" \
|
||||
-XX:+UseG1GC \
|
||||
-XX:+ParallelRefProcEnabled \
|
||||
-XX:MaxGCPauseMillis=200 \
|
||||
-XX:+UnlockExperimentalVMOptions \
|
||||
-XX:+DisableExplicitGC \
|
||||
-XX:+AlwaysPreTouch \
|
||||
-XX:G1NewSizePercent="$([ $XMS -gt 12 ] && echo 40 || echo 30)" \
|
||||
-XX:G1MaxNewSizePercent="$([ $XMS -gt 12 ] && echo 50 || echo 40)" \
|
||||
-XX:G1HeapRegionSize="$([ $XMS -gt 12 ] && echo 16 || echo 8)"M \
|
||||
-XX:G1ReservePercent="$([ $XMS -gt 12 ] && echo 15 || echo 20)" \
|
||||
-XX:G1HeapWastePercent=5 \
|
||||
-XX:G1MixedGCCountTarget=4 \
|
||||
-XX:InitiatingHeapOccupancyPercent="$([ $XMS -gt 12 ] && echo 20 || echo 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 \
|
||||
-jar "$FORGE_JAR" \
|
||||
--universe /mc/worlds \
|
||||
--nogui
|
||||
69
minecraft/forge/README.md
Normal file
69
minecraft/forge/README.md
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<!---
|
||||
|
||||
Copyright (C) 2020 Jef Roosens
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
# Build arguments
|
||||
Two build arguments are required, namely `MC_VERSION` and `FORGE_VERSION`. You
|
||||
can find your required versions [here](https://files.minecraftforge.net/).
|
||||
Then, you can specify them in the `.env` file:
|
||||
|
||||
```
|
||||
MC_VERSION=1.16.4
|
||||
FORGE_VERSION=35.1.4
|
||||
```
|
||||
|
||||
# Environment variables
|
||||
The two possible environment variables are `XMS` and `XMX`. These specify the
|
||||
initial RAM & maximum RAM usage respectively. Only `XMS` is required; `XMX` is
|
||||
just set to the same value as `XMS` if not specified. You must specify them as
|
||||
a number, e.g. `XMS=4`. This number represents a quantity of gigabytes.
|
||||
|
||||
# Mount points
|
||||
There a three useful mount points defined:
|
||||
|
||||
* `/mc/config`: this is where all server config files reside.
|
||||
* `/mc/config/mods`: this is where all mods should be placed.
|
||||
* `/mc/worlds`: this is where the world files are stored.
|
||||
|
||||
You can mount these directories somewhere in the host file system by specifying
|
||||
the mount paths in the `.env` file. These can be both absolute or relative
|
||||
paths.
|
||||
|
||||
# Other config variables
|
||||
The only other config variable is `PORT`. This specifies on what port your
|
||||
server will be discoverable over the internet. The default Minecraft port is
|
||||
`25565`.
|
||||
|
||||
# Java flags
|
||||
I use the Java flags defined
|
||||
[here](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/).
|
||||
If you don't agree with this decision, you can change the `ENTRYPOINT` at the
|
||||
end of the `Dockerfile` to the following:
|
||||
|
||||
```
|
||||
ENTRYPOINT java \
|
||||
-Xms"${XMS}G" \
|
||||
-Xmx"${XMX:-$XMS}G" \
|
||||
-jar "$FORGE_JAR" \
|
||||
--universe /mc/worlds \
|
||||
--nogui
|
||||
```
|
||||
|
||||
This will only use the flags absolutely necessary, while still allowing you to
|
||||
tweak the memory variables.
|
||||
39
minecraft/forge/docker-compose.yml
Normal file
39
minecraft/forge/docker-compose.yml
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright (C) 2020 Jef Roosens
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
version: '3.5'
|
||||
services:
|
||||
forge:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- 'MC_VERSION=${MC_VERSION}'
|
||||
- 'FORGE_VERSION=${FORGE_VERSION}'
|
||||
image: 'mc-forge-server:${MC_VERSION}-${FORGE_VERSION}'
|
||||
|
||||
restart: 'unless-stopped'
|
||||
stdin_open: true
|
||||
tty: true
|
||||
|
||||
environment:
|
||||
- XMS
|
||||
- XMX
|
||||
ports:
|
||||
- '$PORT:25565'
|
||||
volumes:
|
||||
- '$CONFIG_DIR:/mc/config'
|
||||
- '$MODS_DIR:/mc/config/mods'
|
||||
- '$WORLDS_DIR:/mc/worlds'
|
||||
Reference in a new issue