|
@ -0,0 +1,39 @@ |
|
|
|
|
|
# -*- mode: shell-script -*- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MINECRAFT_PATH="$SERVICE_CONFIGSTORE/opt/apps/minecraft" |
|
|
|
|
|
MINECRAFT_DATA="/var/lib/minecraft" |
|
|
|
|
|
|
|
|
|
|
|
minecraft:init-binary() { |
|
|
|
|
|
local version="$1" |
|
|
|
|
|
|
|
|
|
|
|
MINECRAFT_BINARY="${MINECRAFT_PATH}/minecraft_server.${version}.jar" |
|
|
|
|
|
if ! [ -f "$MINECRAFT_BINARY" ]; then |
|
|
|
|
|
mkdir -p "${MINECRAFT_PATH}" |
|
|
|
|
|
wget "https://docker.0k.io/downloads/minecraft_server.${version}.jar" \ |
|
|
|
|
|
-O "$MINECRAFT_BINARY" |
|
|
|
|
|
fi |
|
|
|
|
|
init-config-add " |
|
|
|
|
|
$SERVICE_NAME: |
|
|
|
|
|
volumes: |
|
|
|
|
|
- \"${MINECRAFT_BINARY}:${MINECRAFT_DATA}/server.jar\" |
|
|
|
|
|
" |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minecraft:init-command() { |
|
|
|
|
|
local threads="${1:-4}" mem="${2:-2048M}" |
|
|
|
|
|
init-config-add " |
|
|
|
|
|
$SERVICE_NAME: |
|
|
|
|
|
command: |
|
|
|
|
|
- java |
|
|
|
|
|
- -Xmx${mem} |
|
|
|
|
|
- -Xms${mem} |
|
|
|
|
|
- -XX:ParallelGCThreads=${threads} |
|
|
|
|
|
- -jar |
|
|
|
|
|
- server.jar |
|
|
|
|
|
- nogui |
|
|
|
|
|
" |
|
|
|
|
|
echo "eula=TRUE" > "$SERVICE_DATASTORE/${MINECRAFT_DATA}/eula.txt" |
|
|
|
|
|
} |