mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-08-06 07:23:18 +00:00
feat: Server library cleanup on paper install (#4046)
This commit is contained in:
@@ -22,6 +22,12 @@ docker run -d --pull=always \
|
|||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Clean server libraries
|
||||||
|
|
||||||
|
By default, supported server types remove stale server libraries during installation by setting `CLEAN_SERVER_LIBRARIES` to `true`. Set `CLEAN_SERVER_LIBRARIES` to `false` to disable this cleanup if it causes unexpected behavior.
|
||||||
|
|
||||||
|
Currently, library cleanup is supported by `TYPE=PAPER`. Other server jar types are not yet supported.
|
||||||
|
|
||||||
## Running as alternate user/group ID
|
## Running as alternate user/group ID
|
||||||
|
|
||||||
By default, the container will switch to and run the Minecraft server as user ID 1000 and group ID 1000; however, that can be changed by setting the environment variables `UID` and `GID`.
|
By default, the container will switch to and run the Minecraft server as user ID 1000 and group ID 1000; however, that can be changed by setting the environment variables `UID` and `GID`.
|
||||||
|
|||||||
@@ -11,17 +11,26 @@ handleDebugMode
|
|||||||
: "${PAPER_DOWNLOAD_URL:=}"
|
: "${PAPER_DOWNLOAD_URL:=}"
|
||||||
: "${PAPER_CUSTOM_JAR:=}"
|
: "${PAPER_CUSTOM_JAR:=}"
|
||||||
: "${PAPER_CONFIG_DEFAULTS_REPO:=${PAPER_CONFIG_REPO:=https://raw.githubusercontent.com/Shonz1/minecraft-default-configs/main}}"
|
: "${PAPER_CONFIG_DEFAULTS_REPO:=${PAPER_CONFIG_REPO:=https://raw.githubusercontent.com/Shonz1/minecraft-default-configs/main}}"
|
||||||
|
: "${CLEAN_SERVER_LIBRARIES:=true}"
|
||||||
|
|
||||||
resultsFile=/data/.paper.env
|
resultsFile=/data/.paper.env
|
||||||
if [[ $PAPER_CUSTOM_JAR ]]; then
|
if [[ $PAPER_CUSTOM_JAR ]]; then
|
||||||
export SERVER="$PAPER_CUSTOM_JAR"
|
export SERVER="$PAPER_CUSTOM_JAR"
|
||||||
elif [[ $PAPER_DOWNLOAD_URL ]]; then
|
elif [[ $PAPER_DOWNLOAD_URL ]]; then
|
||||||
if ! mc-image-helper install-paper \
|
|
||||||
--output-directory=/data \
|
args=(
|
||||||
--results-file="$resultsFile" \
|
--output-directory=/data
|
||||||
--url="$PAPER_DOWNLOAD_URL"; then
|
--results-file="$resultsFile"
|
||||||
logError "Failed to download from custom PaperMC URL"
|
--url="$PAPER_DOWNLOAD_URL"
|
||||||
exit 1
|
)
|
||||||
|
|
||||||
|
if [[ $CLEAN_SERVER_LIBRARIES ]]; then
|
||||||
|
args+=(--clean-libraries)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! mc-image-helper install-paper "${args[@]}"; then
|
||||||
|
logError "Failed to download from custom PaperMC URL"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
applyResultsFile ${resultsFile}
|
applyResultsFile ${resultsFile}
|
||||||
else
|
else
|
||||||
@@ -35,6 +44,11 @@ else
|
|||||||
if [[ $PAPER_BUILD ]]; then
|
if [[ $PAPER_BUILD ]]; then
|
||||||
args+=(--build="$PAPER_BUILD")
|
args+=(--build="$PAPER_BUILD")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $CLEAN_SERVER_LIBRARIES ]]; then
|
||||||
|
args+=(--clean-libraries)
|
||||||
|
fi
|
||||||
|
|
||||||
if ! mc-image-helper install-paper "${args[@]}"; then
|
if ! mc-image-helper install-paper "${args[@]}"; then
|
||||||
logError "Failed to download $PAPER_PROJECT"
|
logError "Failed to download $PAPER_PROJECT"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user