mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-23 00:44:53 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
194accb407 | ||
|
|
7f1affbcd8 | ||
|
|
4cbdf520c8 | ||
|
|
a3bb7bff34 | ||
|
|
1e77b81b32 | ||
|
|
479973c950 | ||
|
|
2a246ee805 | ||
|
|
3c4c94e1ad |
@@ -8,11 +8,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# If forked, changed to your username to enable auto-releases
|
# If forked, changed to your username to enable auto-releases
|
||||||
if: github.repository_owner == 'itzg'
|
if: github.repository_owner == 'itzg'
|
||||||
permissions:
|
|
||||||
# allow for creating releases/tags
|
|
||||||
contents: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: zenengeo/github-auto-release-action@main
|
- uses: zenengeo/github-auto-release-action@main
|
||||||
with:
|
with:
|
||||||
stable-duration: 3d
|
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"
|
- "zensical.toml"
|
||||||
- ".readthedocs.yaml"
|
- ".readthedocs.yaml"
|
||||||
- "renovate.json5"
|
- "renovate.json5"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -80,27 +81,27 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.16.5
|
mcVersion: 1.16.5
|
||||||
# Pin version for pre-Java 17
|
# Pin version for pre-Java 17
|
||||||
mcHelperVersion: 1.51.3-java8
|
mcHelperVersion: 1.51.4-java8
|
||||||
# JAVA 11
|
# JAVA 11
|
||||||
- variant: java11
|
- variant: java11
|
||||||
baseImage: adoptopenjdk:11-jre-hotspot
|
baseImage: adoptopenjdk:11-jre-hotspot
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.16.4
|
mcVersion: 1.16.4
|
||||||
# Pin version for pre-Java 17
|
# 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
|
# JAVA 8: NOTE: Unable to go past 8u312 because of Forge dependencies
|
||||||
- variant: java8
|
- variant: java8
|
||||||
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
mcVersion: 1.12.2
|
mcVersion: 1.12.2
|
||||||
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
# 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
|
- variant: java8-jdk
|
||||||
baseImage: eclipse-temurin:8u312-b07-jdk-focal
|
baseImage: eclipse-temurin:8u312-b07-jdk-focal
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
mcVersion: 1.12.2
|
mcVersion: 1.12.2
|
||||||
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
# 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:
|
env:
|
||||||
# Assume they line up, but when forked change to your Docker Hub username
|
# Assume they line up, but when forked change to your Docker Hub username
|
||||||
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ jobs:
|
|||||||
mcVersion: 1.20.4
|
mcVersion: 1.20.4
|
||||||
# For GLIBC_2.34 support
|
# For GLIBC_2.34 support
|
||||||
knockdRepoOrg: Metalcape/knock
|
knockdRepoOrg: Metalcape/knock
|
||||||
|
# JAVA 8:
|
||||||
- variant: java8
|
- variant: java8
|
||||||
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
baseImage: eclipse-temurin:8u312-b07-jre-focal
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
@@ -54,7 +55,7 @@ jobs:
|
|||||||
# For GLIBC_2.34 support
|
# For GLIBC_2.34 support
|
||||||
knockdRepoOrg: Metalcape/knock
|
knockdRepoOrg: Metalcape/knock
|
||||||
# Pin version for Java 8, be sure to also set in build.yml
|
# Pin version for Java 8, be sure to also set in build.yml
|
||||||
mcHelperVersion: 1.51.3-java8
|
mcHelperVersion: 1.51.4-java8
|
||||||
env:
|
env:
|
||||||
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
|
||||||
runs-on: ubuntu-22.04
|
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
|
--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
|
# renovate: datasource=github-releases packageName=itzg/mc-image-helper versioning=loose
|
||||||
ARG MC_HELPER_VERSION=1.61.4
|
ARG MC_HELPER_VERSION=1.63.0
|
||||||
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
|
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
|
# used for cache busting local copy of mc-image-helper
|
||||||
ARG MC_HELPER_REV=1
|
ARG MC_HELPER_REV=1
|
||||||
|
|||||||
@@ -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`.
|
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
|
## 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`.
|
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`.
|
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
|
## 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:
|
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
|
mkdocstrings-python==2.0.5
|
||||||
packaging==26.2
|
packaging==26.2
|
||||||
pathspec==1.1.1
|
pathspec==1.1.1
|
||||||
platformdirs==4.10.0
|
platformdirs==4.11.0
|
||||||
Pygments==2.20.0
|
Pygments==2.20.0
|
||||||
pymdown-extensions==11.0.1
|
pymdown-extensions==11.0.1
|
||||||
python-dateutil==2.9.0.post0
|
python-dateutil==2.9.0.post0
|
||||||
@@ -22,4 +22,4 @@ PyYAML==6.0.3
|
|||||||
pyyaml_env_tag==1.1
|
pyyaml_env_tag==1.1
|
||||||
six==1.17.0
|
six==1.17.0
|
||||||
watchdog==6.0.0
|
watchdog==6.0.0
|
||||||
zensical==0.0.50
|
zensical==0.0.51
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ IFS=$'\n\t'
|
|||||||
|
|
||||||
: "${EULA:=}"
|
: "${EULA:=}"
|
||||||
: "${PROXY:=}"
|
: "${PROXY:=}"
|
||||||
|
: "${PREFER_IPV6:=false}"
|
||||||
: "${ENABLE_AUTOPAUSE:=false}"
|
: "${ENABLE_AUTOPAUSE:=false}"
|
||||||
: "${ENABLE_AUTOSTOP:=false}"
|
: "${ENABLE_AUTOSTOP:=false}"
|
||||||
: "${RCON_CMDS_STARTUP:=}"
|
: "${RCON_CMDS_STARTUP:=}"
|
||||||
@@ -28,6 +29,13 @@ shopt -s nullglob
|
|||||||
|
|
||||||
isDebugging && set -x
|
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
|
if (( $(mc-image-helper java-release) >= 17 )); then
|
||||||
MC_IMAGE_HELPER_OPTS+=" --enable-native-access=ALL-UNNAMED"
|
MC_IMAGE_HELPER_OPTS+=" --enable-native-access=ALL-UNNAMED"
|
||||||
export MC_IMAGE_HELPER_OPTS
|
export MC_IMAGE_HELPER_OPTS
|
||||||
|
|||||||
+16
-40
@@ -5,52 +5,28 @@
|
|||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
resolveVersion
|
resultsFile=/data/.install-vanilla.env
|
||||||
export SERVER="minecraft_server.${VERSION// /_}.jar"
|
|
||||||
|
|
||||||
if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
args=(
|
||||||
debug "Finding version manifest for $VERSION"
|
--output-directory=/data
|
||||||
versionManifestUrl=$(get 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VERSION "$VERSION" --raw-output '[.versions[]|select(.id == $VERSION)][0].url')
|
--results-file="${resultsFile}"
|
||||||
result=$?
|
--version="${VERSION}"
|
||||||
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"
|
|
||||||
|
|
||||||
if ! serverDownloadUrl=$(get --json-path '$.downloads.server.url' "${versionManifestUrl}"); then
|
if isTrue "${FORCE_REDOWNLOAD}"; then
|
||||||
logError "Failed to obtain version manifest from $versionManifestUrl ($result)"
|
log "Forcing re-install of Minecraft"
|
||||||
exit 1
|
args+=(--force-reinstall)
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
minecraftServerJarPath=/data/minecraft_server.jar
|
|
||||||
|
|
||||||
if versionLessThan 1.6; then
|
if ! mc-image-helper install-vanilla "${args[@]}"; then
|
||||||
if ! [[ -L $minecraftServerJarPath && $minecraftServerJarPath -ef "/data/$SERVER" ]]; then
|
logError "Failed to install vanilla Minecraft version $VERSION"
|
||||||
rm -f $minecraftServerJarPath
|
exit 1
|
||||||
ln -s "/data/$SERVER" $minecraftServerJarPath
|
|
||||||
fi
|
|
||||||
SERVER=minecraft_server.jar
|
|
||||||
elif [[ -L $minecraftServerJarPath ]]; then
|
|
||||||
rm -f $minecraftServerJarPath
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
applyResultsFile "${resultsFile}"
|
||||||
|
|
||||||
|
log "Successfully setup vanilla Minecraft version $VERSION"
|
||||||
|
|
||||||
isDebugging && ls -l
|
isDebugging && ls -l
|
||||||
export FAMILY=VANILLA
|
export FAMILY=VANILLA
|
||||||
exec "$(dirname "$0")/start-setupWorld" "$@"
|
exec "$(dirname "$0")/start-setupWorld" "$@"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
: "${DEBUG_EXEC:=false}"
|
: "${DEBUG_EXEC:=false}"
|
||||||
: "${SETUP_ONLY:=false}"
|
: "${SETUP_ONLY:=false}"
|
||||||
: "${CUSTOM_JAR_EXEC:=}"
|
: "${CUSTOM_JAR_EXEC:=}"
|
||||||
|
: "${SERVER_RUNNER:=mc-server-runner}"
|
||||||
|
|
||||||
# shellcheck source=start-utils
|
# shellcheck source=start-utils
|
||||||
. "$(dirname "$0")/start-utils"
|
. "$(dirname "$0")/start-utils"
|
||||||
@@ -96,7 +97,7 @@ fi
|
|||||||
if versionLessThan 1.7; then
|
if versionLessThan 1.7; then
|
||||||
: # No patch required here.
|
: # No patch required here.
|
||||||
elif versionLessThan 1.18.1; then
|
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"
|
log "Skipping Log4jPatcher, make sure you are not affected"
|
||||||
else
|
else
|
||||||
JVM_OPTS="-javaagent:/image/Log4jPatcher.jar ${JVM_OPTS}"
|
JVM_OPTS="-javaagent:/image/Log4jPatcher.jar ${JVM_OPTS}"
|
||||||
@@ -496,7 +497,7 @@ if [[ ${TYPE} == "CURSEFORGE" && "${SERVER}" ]]; then
|
|||||||
if isTrue "${DEBUG_EXEC}"; then
|
if isTrue "${DEBUG_EXEC}"; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
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
|
elif [[ ${TYPE} == "CURSEFORGE" ]]; then
|
||||||
mcServerRunnerArgs+=(--shell bash)
|
mcServerRunnerArgs+=(--shell bash)
|
||||||
|
|
||||||
@@ -550,18 +551,18 @@ fi
|
|||||||
JVM_ARGS=${JVM_ARGS//$'\n'/}
|
JVM_ARGS=${JVM_ARGS//$'\n'/}
|
||||||
sed -i "s~JAVA_ARGS=.*~JAVA_ARGS=\"${JVM_ARGS}\"~" "${FTB_DIR}/variables.txt"
|
sed -i "s~JAVA_ARGS=.*~JAVA_ARGS=\"${JVM_ARGS}\"~" "${FTB_DIR}/variables.txt"
|
||||||
fi
|
fi
|
||||||
exec mc-server-runner "${mcServerRunnerArgs[@]}" "${finalArgs[@]}"
|
exec ${SERVER_RUNNER} "${mcServerRunnerArgs[@]}" -- "${finalArgs[@]}"
|
||||||
elif [[ $SERVER =~ run.sh ]]; then
|
elif [[ $SERVER =~ run.sh ]]; then
|
||||||
log "Using Forge supplied run.sh script..."
|
log "Using Forge supplied run.sh script..."
|
||||||
echo $JVM_XX_OPTS $JVM_OPTS $expandedDOpts > user_jvm_args.txt
|
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}"
|
echo "SETUP_ONLY: bash ${SERVER}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if isTrue "${DEBUG_EXEC}"; then
|
if isTrue "${DEBUG_EXEC}"; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
exec mc-server-runner "${mcServerRunnerArgs[@]}" --shell bash "${SERVER}" $EXTRA_ARGS
|
exec ${SERVER_RUNNER} "${mcServerRunnerArgs[@]}" --shell bash -- "${SERVER}" $EXTRA_ARGS
|
||||||
else
|
else
|
||||||
# If we have a bootstrap.txt file... feed that in to the server stdin
|
# If we have a bootstrap.txt file... feed that in to the server stdin
|
||||||
if [ -f $bootstrapPath ]; then
|
if [ -f $bootstrapPath ]; then
|
||||||
@@ -590,7 +591,7 @@ else
|
|||||||
"$@" $EXTRA_ARGS
|
"$@" $EXTRA_ARGS
|
||||||
)
|
)
|
||||||
|
|
||||||
if isTrue ${SETUP_ONLY}; then
|
if isTrue "${SETUP_ONLY}"; then
|
||||||
echo "SETUP_ONLY: java ${finalArgs[*]}"
|
echo "SETUP_ONLY: java ${finalArgs[*]}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@@ -599,5 +600,5 @@ else
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec mc-server-runner ${bootstrapArgs} "${mcServerRunnerArgs[@]}" java "${finalArgs[@]}"
|
exec ${SERVER_RUNNER} ${bootstrapArgs} "${mcServerRunnerArgs[@]}" -- java "${finalArgs[@]}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user