mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-30 20:25:56 +00:00
Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f7d12a146 | ||
|
|
162bd9b5f1 | ||
|
|
614d3f481b | ||
|
|
ca381904ad | ||
|
|
9a2348cadd | ||
|
|
33159ddd83 | ||
|
|
7e1c26a18f | ||
|
|
0459532398 | ||
|
|
99d4481c01 | ||
|
|
194accb407 | ||
|
|
7f1affbcd8 | ||
|
|
4cbdf520c8 | ||
|
|
a3bb7bff34 | ||
|
|
1e77b81b32 | ||
|
|
479973c950 | ||
|
|
2a246ee805 | ||
|
|
3c4c94e1ad |
@@ -8,11 +8,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
# If forked, changed to your username to enable auto-releases
|
||||
if: github.repository_owner == 'itzg'
|
||||
permissions:
|
||||
# allow for creating releases/tags
|
||||
contents: write
|
||||
steps:
|
||||
- uses: zenengeo/github-auto-release-action@main
|
||||
with:
|
||||
stable-duration: 3d
|
||||
force-duration: 14d
|
||||
force-duration: 14d
|
||||
# It is important to use a token other than the workflow allocated GITHUB_TOKEN,
|
||||
# since actions prevent loops by disallowing recursive workflow triggers with that token.
|
||||
# In this case, the created tag needs to trigger the "Build and Publish" workflow.
|
||||
token: '${{ secrets.GH_TOKEN }}'
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ on:
|
||||
- "zensical.toml"
|
||||
- ".readthedocs.yaml"
|
||||
- "renovate.json5"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -45,8 +46,6 @@ jobs:
|
||||
baseImage: eclipse-temurin:25-jre-noble
|
||||
platforms: linux/amd64,linux/arm64,linux/riscv64
|
||||
mcVersion: latest
|
||||
# forked build that include riscv64
|
||||
knockdRepoOrg: Opvolger/knock
|
||||
- variant: java25-alpine
|
||||
baseImage: eclipse-temurin:25-jre-alpine
|
||||
platforms: linux/amd64,linux/arm64
|
||||
@@ -80,27 +79,27 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
mcVersion: 1.16.5
|
||||
# Pin version for pre-Java 17
|
||||
mcHelperVersion: 1.51.3-java8
|
||||
mcHelperVersion: 1.51.4-java8
|
||||
# JAVA 11
|
||||
- variant: java11
|
||||
baseImage: adoptopenjdk:11-jre-hotspot
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
mcVersion: 1.16.4
|
||||
# Pin version for pre-Java 17
|
||||
mcHelperVersion: 1.51.3-java8
|
||||
mcHelperVersion: 1.51.4-java8
|
||||
# JAVA 8: NOTE: Unable to go past 8u312 because of Forge dependencies
|
||||
- variant: java8
|
||||
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
mcVersion: 1.12.2
|
||||
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
||||
mcHelperVersion: 1.51.3-java8
|
||||
mcHelperVersion: 1.51.4-java8
|
||||
- variant: java8-jdk
|
||||
baseImage: eclipse-temurin:8u312-b07-jdk-focal
|
||||
platforms: linux/amd64,linux/arm64
|
||||
mcVersion: 1.12.2
|
||||
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
||||
mcHelperVersion: 1.51.3-java8
|
||||
mcHelperVersion: 1.51.4-java8
|
||||
env:
|
||||
# Assume they line up, but when forked change to your Docker Hub username
|
||||
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
||||
@@ -179,14 +178,14 @@ jobs:
|
||||
tests/test.sh
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v4.4.0
|
||||
uses: docker/login-action@v4.5.2
|
||||
if: env.HAS_IMAGE_REPO_ACCESS
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v4.4.0
|
||||
uses: docker/login-action@v4.5.2
|
||||
if: env.HAS_IMAGE_REPO_ACCESS
|
||||
with:
|
||||
registry: ghcr.io
|
||||
|
||||
@@ -13,7 +13,7 @@ jobs:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Process Stale Issues
|
||||
uses: actions/stale@v10
|
||||
uses: actions/stale@v11
|
||||
with:
|
||||
stale-issue-label: status/stale
|
||||
stale-pr-label: status/stale
|
||||
|
||||
@@ -47,6 +47,7 @@ jobs:
|
||||
mcVersion: 1.20.4
|
||||
# For GLIBC_2.34 support
|
||||
knockdRepoOrg: Metalcape/knock
|
||||
# JAVA 8:
|
||||
- variant: java8
|
||||
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
||||
platforms: linux/amd64
|
||||
@@ -54,7 +55,7 @@ jobs:
|
||||
# For GLIBC_2.34 support
|
||||
knockdRepoOrg: Metalcape/knock
|
||||
# Pin version for Java 8, be sure to also set in build.yml
|
||||
mcHelperVersion: 1.51.3-java8
|
||||
mcHelperVersion: 1.51.4-java8
|
||||
env:
|
||||
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
# renovate: datasource=github-releases packageName=itzg/mc-image-helper versioning=loose
|
||||
ARG MC_HELPER_VERSION=1.61.4
|
||||
ARG MC_HELPER_VERSION=1.63.2
|
||||
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
|
||||
# used for cache busting local copy of mc-image-helper
|
||||
ARG MC_HELPER_REV=1
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
[](https://www.buymeacoffee.com/itzg)
|
||||
[](https://docker-minecraft-server.readthedocs.io/en/latest/?badge=latest)
|
||||
|
||||
[](https://docker-minecraft-server.readthedocs.io/)
|
||||
[](https://docker-minecraft-server.readthedocs.io/)
|
||||
|
||||
There you will find things like
|
||||
|
||||
- [Quick start with Docker Compose](https://docker-minecraft-server.readthedocs.io/en/latest/#using-docker-compose)
|
||||
- Running [different versions of Minecraft](https://docker-minecraft-server.readthedocs.io/en/latest/versions/minecraft/) and using [various server types](https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/) for Java Edition
|
||||
- [Setting server properties via container environment variables](https://docker-minecraft-server.readthedocs.io/en/latest/configuration/server-properties/)
|
||||
@@ -36,6 +37,12 @@ This image only supports Java edition natively; however, if looking for a server
|
||||
|
||||
<br clear="left" />
|
||||
|
||||
<a href="https://seedloaf.com"><img src="https://seedloaf.com/images/logo.webp" alt="Seedloaf logo" width="48" align="left" /></a>
|
||||
|
||||
<a href="https://seedloaf.com"><b>Seedloaf</b></a> - Built from scratch (by two nerds) on top of <code>itzg/minecraft-server</code>. Seedloaf offers free, and premium Minecraft servers where you have full control!
|
||||
|
||||
<br clear="left" />
|
||||
|
||||
<!-- additional sponsors repeat the pattern above: floated logo + blurb + clear-left break -->
|
||||
<!-- logo image preferrably hosted on an external, stable site at a size of 48x48px -->
|
||||
<!-- link to sponsor site -->
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# Patched knockd is only available for amd64 on Alpine, so install the package for other architectures
|
||||
knockPkg=""
|
||||
if [ "$TARGETARCH" != amd64 ]; then
|
||||
knockPkg="knock"
|
||||
echo "Installing knock package for $TARGETARCH architecture"
|
||||
fi
|
||||
|
||||
# Install necessary packages
|
||||
# shellcheck disable=SC2086
|
||||
apk add --no-cache -U \
|
||||
@@ -36,13 +43,18 @@ apk add --no-cache -U \
|
||||
numactl \
|
||||
jattach \
|
||||
gcompat \
|
||||
"$knockPkg" \
|
||||
${EXTRA_ALPINE_PACKAGES}
|
||||
|
||||
# Download and install patched knockd
|
||||
curl -fsSL -o /tmp/knock.tar.gz "https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-alpine-amd64.tar.gz"
|
||||
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
||||
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
|
||||
setcap cap_net_raw=ep /usr/local/sbin/knockd
|
||||
if ! [ "$knockPkg" ]; then
|
||||
# Download and install patched knockd
|
||||
knockdUrl="https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-alpine-amd64.tar.gz"
|
||||
echo "Downloading knockd from $knockdUrl"
|
||||
curl -fsSL -o /tmp/knock.tar.gz "$knockdUrl"
|
||||
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
||||
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
|
||||
setcap cap_net_raw=ep /usr/local/sbin/knockd
|
||||
fi
|
||||
|
||||
# Set Git credentials globally
|
||||
cat <<EOF >> /etc/gitconfig
|
||||
|
||||
@@ -37,8 +37,13 @@ apt-get install -y \
|
||||
# Clean up APT when done
|
||||
apt-get clean
|
||||
|
||||
if [ "$TARGETARCH" = riscv64 ]; then
|
||||
KNOCKD_REPO_ORG=Opvolger/knock
|
||||
fi
|
||||
# Download and install patched knockd
|
||||
curl -fsSL -o /tmp/knock.tar.gz "https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-$TARGET.tar.gz"
|
||||
knockdUrl="https://github.com/${KNOCKD_REPO_ORG}/releases/download/${KNOCKD_VERSION}/knock-${KNOCKD_VERSION}-$TARGET.tar.gz"
|
||||
echo "Downloading knockd from $knockdUrl"
|
||||
curl -fsSL -o /tmp/knock.tar.gz "$knockdUrl"
|
||||
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
||||
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
|
||||
setcap cap_net_raw=ep /usr/local/sbin/knockd
|
||||
|
||||
@@ -179,6 +179,10 @@ such as:
|
||||
|
||||
You may configure the use of an HTTP/HTTPS proxy by passing the proxy's "host:port" via the environment variable `PROXY`. In [the example compose file](https://github.com/itzg/docker-minecraft-server/blob/master/examples/proxied/compose.yml) it references a Squid proxy. The host and port can be separately passed via the environment variables `PROXY_HOST` and `PROXY_PORT`. A `|` delimited list of hosts to exclude from proxying can be passed via `PROXY_NON_PROXY_HOSTS`.
|
||||
|
||||
## Prefer IPv6 Addresses and Stack
|
||||
|
||||
The image can be configured to prefer IPv6 addresses and stack by setting the environment variable `PREFER_IPV6` to "true". This will ensure the Java properties `java.net.preferIPv6Addresses` and `java.net.preferIPv6Stack` are set accordingly for mc-image-helper and the Minecraft server process.
|
||||
|
||||
## Using "noconsole" option
|
||||
|
||||
Some older versions (pre-1.14) of Spigot required `--noconsole` to be passed when detaching stdin, which can be done by setting `-e CONSOLE=FALSE`.
|
||||
@@ -198,6 +202,13 @@ Be sure to also increase the shutdown timeout described [here for docker compose
|
||||
|
||||
If you are using a host-attached data directory, then you can have the image setup the Minecraft server files and stop prior to launching the server process by setting `SETUP_ONLY` to `true`.
|
||||
|
||||
## Custom server runner
|
||||
|
||||
By default, the image finishes startup by exec'ing [mc-server-runner](https://github.com/itzg/mc-server-runner) to run the Minecraft server itself. This can be replaced by setting the environment variable `SERVER_RUNNER`. The arguments passed will start with ones specific to mc-server-runner, followed by `--`, and then the actual `java -jar` arguments or equivalent server entry script, such as `run.sh` for Forge.
|
||||
|
||||
> [!TIP]
|
||||
> The `SERVER_RUNNER` variable is expanded when passed to `exec` so that `mc-server-runner` can be wrapped by another executable that is mounted into the container.
|
||||
|
||||
## Enable Flare Flags
|
||||
|
||||
To enable the JVM flags required to fully support the [Flare profiling suite](https://blog.airplane.gg/flare), set the following variable:
|
||||
|
||||
@@ -14,7 +14,7 @@ mkdocstrings==1.0.6
|
||||
mkdocstrings-python==2.0.5
|
||||
packaging==26.2
|
||||
pathspec==1.1.1
|
||||
platformdirs==4.10.0
|
||||
platformdirs==4.11.0
|
||||
Pygments==2.20.0
|
||||
pymdown-extensions==11.0.1
|
||||
python-dateutil==2.9.0.post0
|
||||
@@ -22,4 +22,4 @@ PyYAML==6.0.3
|
||||
pyyaml_env_tag==1.1
|
||||
six==1.17.0
|
||||
watchdog==6.0.0
|
||||
zensical==0.0.50
|
||||
zensical==0.0.51
|
||||
|
||||
@@ -12,7 +12,7 @@ Configuration options with defaults:
|
||||
|
||||
## Set Modpack version
|
||||
|
||||
As GTNH is a Minecraft 1.7.10 modpack, when using it your minecraft version is set to 1.7.10 by default. The [modpack version](https://www.gtnewhorizons.com/downloads/) can be selected by setting `GTNH_PACK_VERSION` to `latest`, `latest-dev` or any specific version number. `latest` will automatically select the latest full release version available and deploy the server with it (Note: this will also automatically update the server on startup). `latest-dev` does the same but selects the latest version marked as beta or RC (it won't select a full release version even if a newer exist). The third (and recommended) option is setting the server to a specific version like `2.8.1` to manage updates manually.
|
||||
As GTNH is a Minecraft 1.7.10 modpack, when using it your minecraft version is set to 1.7.10 by default. The [modpack version](https://www.gtnewhorizons.com/downloads/) can be selected by setting `GTNH_PACK_VERSION` to `latest`, `latest-beta` (formerly `latest-dev`) or any specific version number. `latest` will automatically select the latest full release version available and deploy the server with it (Note: this will also automatically update the server on startup). `latest-beta` does the same but selects the latest version marked as beta or RC (it won't select a full release version even if a newer exist). The third (and recommended) option is setting the server to a specific version like `2.8.1` to manage updates manually.
|
||||
|
||||
> To actively prevent an update from happening you can set the environment variable `SKIP_GTNH_UPDATE_CHECK` to true this will prevent any update check from running, but will also prevent the server install from running, so just set it after the initial setup.
|
||||
|
||||
@@ -52,3 +52,11 @@ To deliver the intended GTNH by default, when running a GTNH server, the followi
|
||||
With java 17+ the server starts with `-Dfml.readTimeout=180 @java9args.txt -jar lwjgl3ify-forgePatches.jar`.
|
||||
|
||||
With java 8 the server stars with `-XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseCodeCacheFlushing -Dfml.readTimeout=180 -jar forge-1.7.10-10.13.4.1614-1.7.10-universal.jar`
|
||||
|
||||
## Developer Versions
|
||||
|
||||
To run the nightly developer builds of GTNH, set the environment variable `GTNH_USE_DAILY_BUILD` to true and set `GTNH_PACK_VERSION` either to `latest` or a specific run ID of the build workflow. The run ID can be found in the [GTNH GitHub Actions](https://github.com/GTNewHorizons/DreamAssemblerXXL/actions) page of the DreamAssemblerXXL repository. The run ID is the number in the URL of the workflow run, for example `123456789`.
|
||||
|
||||
Since downloads require authentication, you will also need to set the environment variable `GH_TOKEN` to a valid GitHub Personal Access Token with `public_repo` scope. You can create a token in your [GitHub settings](https://github.com/settings/tokens) page. Be sure to keep your token secret and do not share it with anyone. The token is only used to download the developer builds and is not stored anywhere in the server (except in the environment variables).
|
||||
|
||||
Keep in mind that developer builds are not stable and may contain bugs or incomplete features. Use them at your own risk. It is recommended to use the latest stable release for production servers!
|
||||
|
||||
@@ -14,6 +14,9 @@ services:
|
||||
# GTNH_DELETE_BACKUPS: true
|
||||
# Use to prevent updates
|
||||
# SKIP_GTNH_UPDATE_CHECK: true
|
||||
# Enable and set Token for daily builds
|
||||
# GTNH_USE_DAILY_BUILD: true
|
||||
# GH_TOKEN: mytoken
|
||||
MEMORY: 6G
|
||||
# Bring in standard extra mods described at https://wiki.gtnewhorizons.com/wiki/Additional_Mods
|
||||
# MODS: |
|
||||
|
||||
@@ -40,7 +40,7 @@ if ! mc-image-helper network-interfaces --check="$AUTOPAUSE_KNOCK_INTERFACE" ; t
|
||||
autopause_error_loop
|
||||
fi
|
||||
|
||||
knockdArgs=(-c /tmp/knockd-config.cfg -d -i "$AUTOPAUSE_KNOCK_INTERFACE")
|
||||
knockdArgs=(-c /data/.knockd.cfg -d -i "$AUTOPAUSE_KNOCK_INTERFACE")
|
||||
if isTrue "${DEBUG_AUTOPAUSE}"; then
|
||||
knockdArgs+=(-D)
|
||||
fi
|
||||
|
||||
+11
-5
@@ -24,13 +24,13 @@ log "Autopause functionality enabled"
|
||||
|
||||
isDebugging && set -x
|
||||
|
||||
cp /image/knockd-config.cfg /tmp/knockd-config.cfg
|
||||
cp /image/knockd-config.cfg /data/.knockd.cfg
|
||||
|
||||
function updatePort() {
|
||||
regseq="^\s*sequence\s*=\s*$1\s*$"
|
||||
linenum=$(grep -nm${2} sequence /tmp/knockd-config.cfg | cut -d : -f 1 | tail -n1)
|
||||
if ! [[ $(awk "NR==$linenum" /tmp/knockd-config.cfg) =~ $regseq ]]; then
|
||||
sed -i "${linenum}s/sequence.*/sequence = $1/" /tmp/knockd-config.cfg
|
||||
linenum=$(grep -nm${2} sequence /data/.knockd.cfg | cut -d : -f 1 | tail -n1)
|
||||
if ! [[ $(awk "NR==$linenum" /data/.knockd.cfg) =~ $regseq ]]; then
|
||||
sed -i "${linenum}s/sequence.*/sequence = $1/" /data/.knockd.cfg
|
||||
log "Updated $3 port in knockd config"
|
||||
fi
|
||||
}
|
||||
@@ -67,6 +67,12 @@ fi
|
||||
# seq_cooldown cannot be larger than AUTOPAUSE_TIMEOUT_KN, otherwise the server may
|
||||
# become paused while knockd is still ignoring packets, preventing players from joining.
|
||||
let COOLDOWN=$AUTOPAUSE_TIMEOUT_KN/2
|
||||
sed -i "s/\(seq_cooldown *= *\).*/\1$COOLDOWN/" /tmp/knockd-config.cfg
|
||||
sed -i "s/\(seq_cooldown *= *\).*/\1$COOLDOWN/" /data/.knockd.cfg
|
||||
|
||||
if isDebugging; then
|
||||
echo "Autopause configuration: ======================================"
|
||||
cat /data/.knockd.cfg
|
||||
echo "==============================================================="
|
||||
fi
|
||||
|
||||
"$(dirname "$0")/auto/autopause-daemon.sh" &
|
||||
|
||||
@@ -7,6 +7,7 @@ IFS=$'\n\t'
|
||||
|
||||
: "${EULA:=}"
|
||||
: "${PROXY:=}"
|
||||
: "${PREFER_IPV6:=false}"
|
||||
: "${ENABLE_AUTOPAUSE:=false}"
|
||||
: "${ENABLE_AUTOSTOP:=false}"
|
||||
: "${RCON_CMDS_STARTUP:=}"
|
||||
@@ -28,6 +29,13 @@ shopt -s nullglob
|
||||
|
||||
isDebugging && set -x
|
||||
|
||||
if isTrue "$PREFER_IPV6"; then
|
||||
MC_IMAGE_HELPER_OPTS+="-Djava.net.preferIPv6Addresses=true -Djava.net.preferIPv6Stack=true"
|
||||
export MC_IMAGE_HELPER_OPTS
|
||||
JVM_DD_OPTS+="java.net.preferIPv6Addresses=true java.net.preferIPv6Stack=true"
|
||||
export JVM_DD_OPTS
|
||||
fi
|
||||
|
||||
if (( $(mc-image-helper java-release) >= 17 )); then
|
||||
MC_IMAGE_HELPER_OPTS+=" --enable-native-access=ALL-UNNAMED"
|
||||
export MC_IMAGE_HELPER_OPTS
|
||||
|
||||
+92
-29
@@ -7,11 +7,13 @@
|
||||
function getGTNHdownloadPath(){
|
||||
gtnh_download_path=""
|
||||
local release_object=""
|
||||
local current_java_version=""
|
||||
current_java_version=$(mc-image-helper java-release)
|
||||
|
||||
# Select release JSON object
|
||||
if [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then
|
||||
# latest-dev will be removed in the future, but is still supported for now.
|
||||
if [ "$GTNH_PACK_VERSION" == "latest-dev" ] || [ "$GTNH_PACK_VERSION" == "latest-beta" ]; then
|
||||
if [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then
|
||||
logWarning "GTNH_PACK_VERSION=latest-dev is deprecated and will be removed in the future."
|
||||
fi
|
||||
if ! release_object="$(
|
||||
curl -fsSL "https://downloads.gtnewhorizons.com/versions.json" \
|
||||
| jq -r '(.versions // .)|to_entries|sort_by(.value.releaseDate)|map(select(.value.title=="Beta release"))|.[-1]'
|
||||
@@ -46,23 +48,18 @@ function getGTNHdownloadPath(){
|
||||
fi
|
||||
|
||||
# Select compatible server files for java version
|
||||
if (( current_java_version == 8 )); then
|
||||
if (( java_version == 8 )); then
|
||||
gtnh_download_path=$(jq -r '.value.server.java8Url' <<< "$release_object")
|
||||
log "Use GTNH Server Java 8 release."
|
||||
|
||||
elif (( current_java_version >= 17 )); then
|
||||
if (( current_java_version > $(jq '.value.maxJavaVersion' <<< "$release_object") )); then
|
||||
logError "Container Java version $current_java_version is not supported by GTNH. Try an older release."
|
||||
elif (( java_version >= 17 )); then
|
||||
if (( java_version > $(jq '.value.maxJavaVersion' <<< "$release_object") )); then
|
||||
logError "Container Java version $java_version is not supported by GTNH. Try an older release."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gtnh_download_path=$(jq -r '.value.server.java17_2XUrl' <<< "$release_object")
|
||||
log "Use GTNH Server Java 17+ release."
|
||||
|
||||
else
|
||||
logError "Container Java version $current_java_version is not supported by GTNH."
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
if [[ -z $gtnh_download_path ]]; then
|
||||
@@ -73,6 +70,56 @@ function getGTNHdownloadPath(){
|
||||
|
||||
}
|
||||
|
||||
function getGTNHdownloadOptions(){
|
||||
# Used for GTNH daily build downloads, to pass additional options to the download command.
|
||||
gtnh_download_options=()
|
||||
# Used for dryrun check
|
||||
gtnh_download_path=""
|
||||
|
||||
# Check if GH_TOKEN is set for daily builds
|
||||
if [ -z "$GH_TOKEN" ]; then
|
||||
logError "GH_TOKEN environment variable must be set to use daily builds."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gtnh_download_options+=( --output-filename )
|
||||
|
||||
# prepare download options as an array to safely append patterns
|
||||
if [ "$GTNH_PACK_VERSION" == "latest" ] || [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then
|
||||
if [ "$GTNH_PACK_VERSION" == "latest-dev" ]; then
|
||||
logWarning "GTNH_PACK_VERSION=latest-dev is deprecated and will be removed in the future."
|
||||
fi
|
||||
gtnh_download_options+=( --workflow=daily-modpack-build.yml )
|
||||
log "Using latest daily build for GTNH server files."
|
||||
elif [ "$GTNH_PACK_VERSION" == "latest-beta" ]; then
|
||||
gtnh_download_options+=( --workflow=daily-modpack-build.yml )
|
||||
logWarning "Using daily build instead of latest beta release for GTNH server files. If this is not intended, set GTNH_USE_DAILY_BUILD=false to use the latest beta release instead."
|
||||
else
|
||||
gtnh_download_options+=( --run-id="$GTNH_PACK_VERSION" )
|
||||
log "Using specific daily build run ID $GTNH_PACK_VERSION for GTNH server files."
|
||||
fi
|
||||
|
||||
# Select compatible server files for java version
|
||||
if (( java_version == 8 )); then
|
||||
log "Use GTNH Server Java 8 release."
|
||||
gtnh_download_options+=( --artifact-pattern='GTNH-daily-\d{4}-\d{2}-\d{2}\+\d+-server-java8\.zip' )
|
||||
|
||||
elif (( java_version >= 17 )); then
|
||||
log "Use GTNH Server Java 17+ release."
|
||||
gtnh_download_options+=( --artifact-pattern='GTNH-daily-\d{4}-\d{2}-\d{2}\+\d+-server-java17-\d{2}\.zip' )
|
||||
fi
|
||||
|
||||
debug "GTNH daily build download options: ${gtnh_download_options[*]}"
|
||||
|
||||
if ! gtnh_download_path=$(mc-image-helper github download-artifact --no-download "${gtnh_download_options[@]}" GTNewHorizons/DreamAssemblerXXL); then
|
||||
logError "Failed to find a matching daily build for GTNH server files with the specified options."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
debug "GTNH daily build download path: $gtnh_download_path"
|
||||
|
||||
}
|
||||
|
||||
function deleteGTNHbackup(){
|
||||
log "Start deleting all config backups"
|
||||
if ! find . -maxdepth 1 -type d -name 'gtnh-upgrade-*' -exec rm -rf {} + ; then
|
||||
@@ -81,24 +128,33 @@ function deleteGTNHbackup(){
|
||||
}
|
||||
|
||||
function downloadGTNH(){
|
||||
local gtnh_download=""
|
||||
gtnh_download=""
|
||||
base_dir=/data/.tmp/gtnh_base
|
||||
|
||||
debug "Creating temporary /data/.tmp/packs folder for GTNH download"
|
||||
mkdir -p /data/.tmp/packs
|
||||
trap 'rm -rf /data/.tmp' EXIT
|
||||
|
||||
log "Downloading $gtnh_download_path."
|
||||
if ! gtnh_download=$(mc-image-helper get -o /data/.tmp/packs --output-filename --skip-up-to-date "$gtnh_download_path"); then
|
||||
logError "Failed to download $gtnh_download_path"
|
||||
exit 1
|
||||
fi
|
||||
debug "Downloaded GTNH server files to $gtnh_download"
|
||||
|
||||
# Unpacking Server files into temporary directory
|
||||
log "Unpacking Server Files into $base_dir"
|
||||
mkdir -p "${base_dir}"
|
||||
extract "${gtnh_download}" "${base_dir}"
|
||||
|
||||
if isTrue "$GTNH_USE_DAILY_BUILD"; then
|
||||
log "Downloading Daily Build for GTNH server files."
|
||||
# gtnh_download_options is injecting download parameters -> (--workflow or --run-id) and --artifact-pattern
|
||||
if ! gtnh_download=$(mc-image-helper github download-artifact -o=$base_dir --unzip "${gtnh_download_options[@]}" GTNewHorizons/DreamAssemblerXXL); then
|
||||
logError "Failed to download Daily Build for GTNH server files."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
log "Downloading $gtnh_download_path."
|
||||
if ! gtnh_download=$(mc-image-helper get -o /data/.tmp/packs --output-filename --skip-up-to-date "$gtnh_download_path"); then
|
||||
logError "Failed to download $gtnh_download_path"
|
||||
exit 1
|
||||
fi
|
||||
debug "Downloaded GTNH server files to $gtnh_download"
|
||||
|
||||
# Unpacking Server files into temporary directory
|
||||
log "Unpacking Server Files into $base_dir"
|
||||
extract "${gtnh_download}" "${base_dir}"
|
||||
fi
|
||||
|
||||
# Remove any eula file since container manages it
|
||||
debug "Removing eula.txt from $base_dir"
|
||||
@@ -209,16 +265,23 @@ function handleGTNH() {
|
||||
: "${GTNH_PACK_VERSION:=latest}"
|
||||
: "${GTNH_DELETE_BACKUPS:=false}"
|
||||
: "${SKIP_GTNH_UPDATE_CHECK:=false}"
|
||||
debug "GTNH VAR CHECK: GTNH_DELETE_BACKUPS=$GTNH_DELETE_BACKUPS, GTNH_PACK_VERSION=$GTNH_PACK_VERSION, TYPE=$TYPE, SKIP_GTNH_UPDATE_CHECK=$SKIP_GTNH_UPDATE_CHECK"
|
||||
: "${GTNH_USE_DAILY_BUILD:=false}"
|
||||
|
||||
debug "GTNH VAR CHECK: GTNH_DELETE_BACKUPS=$GTNH_DELETE_BACKUPS, GTNH_PACK_VERSION=$GTNH_PACK_VERSION, TYPE=$TYPE, SKIP_GTNH_UPDATE_CHECK=$SKIP_GTNH_UPDATE_CHECK, GTNH_USE_DAILY_BUILD=$GTNH_USE_DAILY_BUILD"
|
||||
|
||||
if isTrue "$GTNH_DELETE_BACKUPS"; then
|
||||
deleteGTNHbackup
|
||||
fi
|
||||
|
||||
if [[ -n "$GTNH_PACK_VERSION" ]] && isFalse "$SKIP_GTNH_UPDATE_CHECK" ; then
|
||||
if [[ -n "$GTNH_PACK_VERSION" ]] && isFalse "$SKIP_GTNH_UPDATE_CHECK"; then
|
||||
|
||||
getGTNHdownloadPath
|
||||
log "Server files located! Will proceed update $gtnh_download_path."
|
||||
if isFalse "$GTNH_USE_DAILY_BUILD"; then
|
||||
getGTNHdownloadPath
|
||||
log "Server files located! Will proceed update $gtnh_download_path."
|
||||
else
|
||||
getGTNHdownloadOptions
|
||||
log "Will proceed update with daily build options: ${gtnh_download_options[*]}."
|
||||
fi
|
||||
|
||||
|
||||
# Decide if update or install is needed or not.
|
||||
@@ -239,7 +302,7 @@ function handleGTNH() {
|
||||
fi
|
||||
|
||||
# Update .gtnh-version
|
||||
basename "$gtnh_download_path" > /data/.gtnh-version
|
||||
basename "$gtnh_download" > /data/.gtnh-version
|
||||
|
||||
# Cleaning up temporary files
|
||||
rm -rf /data/.tmp
|
||||
|
||||
+16
-40
@@ -5,52 +5,28 @@
|
||||
isDebugging && set -x
|
||||
set -o pipefail
|
||||
|
||||
resolveVersion
|
||||
export SERVER="minecraft_server.${VERSION// /_}.jar"
|
||||
resultsFile=/data/.install-vanilla.env
|
||||
|
||||
if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||
debug "Finding version manifest for $VERSION"
|
||||
versionManifestUrl=$(get 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VERSION "$VERSION" --raw-output '[.versions[]|select(.id == $VERSION)][0].url')
|
||||
result=$?
|
||||
if [ $result != 0 ]; then
|
||||
logError "Failed to obtain version manifest URL ($result)"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$versionManifestUrl" = "null" ]; then
|
||||
logError "Couldn't find a matching manifest entry for $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
debug "Found version manifest at $versionManifestUrl"
|
||||
args=(
|
||||
--output-directory=/data
|
||||
--results-file="${resultsFile}"
|
||||
--version="${VERSION}"
|
||||
)
|
||||
|
||||
if ! serverDownloadUrl=$(get --json-path '$.downloads.server.url' "${versionManifestUrl}"); then
|
||||
logError "Failed to obtain version manifest from $versionManifestUrl ($result)"
|
||||
exit 1
|
||||
elif [ "$serverDownloadUrl" = "null" ]; then
|
||||
logError "There is not a server download for version $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Downloading $VERSION server..."
|
||||
debug "Downloading server from $serverDownloadUrl"
|
||||
get -o "$SERVER" "$serverDownloadUrl"
|
||||
result=$?
|
||||
if [ $result != 0 ]; then
|
||||
logError "Failed to download server from $serverDownloadUrl ($result)"
|
||||
exit 1
|
||||
fi
|
||||
if isTrue "${FORCE_REDOWNLOAD}"; then
|
||||
log "Forcing re-install of Minecraft"
|
||||
args+=(--force-reinstall)
|
||||
fi
|
||||
minecraftServerJarPath=/data/minecraft_server.jar
|
||||
|
||||
if versionLessThan 1.6; then
|
||||
if ! [[ -L $minecraftServerJarPath && $minecraftServerJarPath -ef "/data/$SERVER" ]]; then
|
||||
rm -f $minecraftServerJarPath
|
||||
ln -s "/data/$SERVER" $minecraftServerJarPath
|
||||
fi
|
||||
SERVER=minecraft_server.jar
|
||||
elif [[ -L $minecraftServerJarPath ]]; then
|
||||
rm -f $minecraftServerJarPath
|
||||
if ! mc-image-helper install-vanilla "${args[@]}"; then
|
||||
logError "Failed to install vanilla Minecraft version $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
applyResultsFile "${resultsFile}"
|
||||
|
||||
log "Successfully setup vanilla Minecraft version $VERSION"
|
||||
|
||||
isDebugging && ls -l
|
||||
export FAMILY=VANILLA
|
||||
exec "$(dirname "$0")/start-setupWorld" "$@"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
: "${DEBUG_EXEC:=false}"
|
||||
: "${SETUP_ONLY:=false}"
|
||||
: "${CUSTOM_JAR_EXEC:=}"
|
||||
: "${SERVER_RUNNER:=mc-server-runner}"
|
||||
|
||||
# shellcheck source=start-utils
|
||||
. "$(dirname "$0")/start-utils"
|
||||
@@ -96,7 +97,7 @@ fi
|
||||
if versionLessThan 1.7; then
|
||||
: # No patch required here.
|
||||
elif versionLessThan 1.18.1; then
|
||||
if isTrue ${SKIP_LOG4J_PATCHER:-false}; then
|
||||
if isTrue "${SKIP_LOG4J_PATCHER:-false}"; then
|
||||
log "Skipping Log4jPatcher, make sure you are not affected"
|
||||
else
|
||||
JVM_OPTS="-javaagent:/image/Log4jPatcher.jar ${JVM_OPTS}"
|
||||
@@ -496,7 +497,7 @@ if [[ ${TYPE} == "CURSEFORGE" && "${SERVER}" ]]; then
|
||||
if isTrue "${DEBUG_EXEC}"; then
|
||||
set -x
|
||||
fi
|
||||
exec mc-server-runner ${bootstrapArgs} "${mcServerRunnerArgs[@]}" java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar "$(basename "${SERVER}")" "$@" $EXTRA_ARGS
|
||||
exec ${SERVER_RUNNER} ${bootstrapArgs} "${mcServerRunnerArgs[@]}" -- java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar "$(basename "${SERVER}")" "$@" $EXTRA_ARGS
|
||||
elif [[ ${TYPE} == "CURSEFORGE" ]]; then
|
||||
mcServerRunnerArgs+=(--shell bash)
|
||||
|
||||
@@ -550,18 +551,18 @@ fi
|
||||
JVM_ARGS=${JVM_ARGS//$'\n'/}
|
||||
sed -i "s~JAVA_ARGS=.*~JAVA_ARGS=\"${JVM_ARGS}\"~" "${FTB_DIR}/variables.txt"
|
||||
fi
|
||||
exec mc-server-runner "${mcServerRunnerArgs[@]}" "${finalArgs[@]}"
|
||||
exec ${SERVER_RUNNER} "${mcServerRunnerArgs[@]}" -- "${finalArgs[@]}"
|
||||
elif [[ $SERVER =~ run.sh ]]; then
|
||||
log "Using Forge supplied run.sh script..."
|
||||
echo $JVM_XX_OPTS $JVM_OPTS $expandedDOpts > user_jvm_args.txt
|
||||
if isTrue ${SETUP_ONLY}; then
|
||||
if isTrue "${SETUP_ONLY}"; then
|
||||
echo "SETUP_ONLY: bash ${SERVER}"
|
||||
exit
|
||||
fi
|
||||
if isTrue "${DEBUG_EXEC}"; then
|
||||
set -x
|
||||
fi
|
||||
exec mc-server-runner "${mcServerRunnerArgs[@]}" --shell bash "${SERVER}" $EXTRA_ARGS
|
||||
exec ${SERVER_RUNNER} "${mcServerRunnerArgs[@]}" --shell bash -- "${SERVER}" $EXTRA_ARGS
|
||||
else
|
||||
# If we have a bootstrap.txt file... feed that in to the server stdin
|
||||
if [ -f $bootstrapPath ]; then
|
||||
@@ -590,7 +591,7 @@ else
|
||||
"$@" $EXTRA_ARGS
|
||||
)
|
||||
|
||||
if isTrue ${SETUP_ONLY}; then
|
||||
if isTrue "${SETUP_ONLY}"; then
|
||||
echo "SETUP_ONLY: java ${finalArgs[*]}"
|
||||
exit
|
||||
fi
|
||||
@@ -599,5 +600,5 @@ else
|
||||
set -x
|
||||
fi
|
||||
|
||||
exec mc-server-runner ${bootstrapArgs} "${mcServerRunnerArgs[@]}" java "${finalArgs[@]}"
|
||||
exec ${SERVER_RUNNER} ${bootstrapArgs} "${mcServerRunnerArgs[@]}" -- java "${finalArgs[@]}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user