mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-06-06 18:59:44 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65fa25b3b3 | |||
| 46272296d2 | |||
| 008bbb3aff | |||
| 882fe89caf |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM openjdk:8u212-jre-alpine
|
FROM adoptopenjdk/openjdk15:alpine-jre
|
||||||
|
|
||||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB |
+43
-55
@@ -4,66 +4,54 @@
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
if [[ $PAPER_DOWNLOAD_URL ]]; then
|
# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
|
||||||
export SERVER=$(getFilenameFromUrl "${PAPER_DOWNLOAD_URL}")
|
|
||||||
|
|
||||||
if [ -f "$SERVER" ]; then
|
build=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
||||||
zarg=(-z "$SERVER")
|
| jq '.builds[-1]')
|
||||||
fi
|
case $? in
|
||||||
|
0)
|
||||||
echo "Preparing custom PaperMC jar from $PAPER_DOWNLOAD_URL"
|
;;
|
||||||
|
22)
|
||||||
curl -fsSL -o "$SERVER" "${zarg[@]}" "${PAPER_DOWNLOAD_URL}"
|
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json")
|
||||||
else
|
if [[ $VERSION = LATEST ]]; then
|
||||||
# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
|
VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]')
|
||||||
|
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
|
||||||
build=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
# re-execute the current script with the newly computed version
|
||||||
| jq '.builds[-1]')
|
exec $0 "$@"
|
||||||
case $? in
|
fi
|
||||||
0)
|
log "ERROR: ${VANILLA_VERSION} is not published by PaperMC"
|
||||||
;;
|
log " Set VERSION to one of the following: "
|
||||||
22)
|
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
|
||||||
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json")
|
|
||||||
if [[ $VERSION = LATEST ]]; then
|
|
||||||
VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]')
|
|
||||||
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
|
|
||||||
# re-execute the current script with the newly computed version
|
|
||||||
exec $0 "$@"
|
|
||||||
fi
|
|
||||||
log "ERROR: ${VANILLA_VERSION} is not published by PaperMC"
|
|
||||||
log " Set VERSION to one of the following: "
|
|
||||||
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "ERROR: unknown error while looking up PaperMC version=${VANILLA_VERSION}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo "ERROR: failed to lookup PaperMC build from version ${VANILLA_VERSION}"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
;;
|
||||||
|
*)
|
||||||
export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \
|
echo "ERROR: unknown error while looking up PaperMC version=${VANILLA_VERSION}"
|
||||||
| jq -r '.downloads.application.name')
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo "ERROR: failed to lookup PaperMC download file from version=${VANILLA_VERSION} build=${build}"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
echo "ERROR: failed to lookup PaperMC build from version ${VANILLA_VERSION}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "$SERVER" ]; then
|
export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \
|
||||||
zarg=(-z "$SERVER")
|
| jq -r '.downloads.application.name')
|
||||||
fi
|
if [ $? != 0 ]; then
|
||||||
|
echo "ERROR: failed to lookup PaperMC download file from version=${VANILLA_VERSION} build=${build}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
|
if [ -f "$SERVER" ]; then
|
||||||
curl -fsSL -o "$SERVER" "${zarg[@]}" \
|
zarg=(-z "$SERVER")
|
||||||
"https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
|
fi
|
||||||
-H "accept: application/java-archive"
|
|
||||||
if [ $? != 0 ]; then
|
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
|
||||||
echo "ERROR: failed to download PaperMC from version=${VANILLA_VERSION} build=${build} download=${SERVER}"
|
curl -fsSL -o "$SERVER" "${zarg[@]}" \
|
||||||
exit 1
|
"https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
|
||||||
fi
|
-H "accept: application/java-archive"
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
echo "ERROR: failed to download PaperMC from version=${VANILLA_VERSION} build=${build} download=${SERVER}"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Normalize on Spigot for downstream operations
|
# Normalize on Spigot for downstream operations
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ case "X$MODCONFIG" in
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetupMounts $@
|
exec ${SCRIPTS:-/}start-finalSetupPlugins $@
|
||||||
|
|||||||
@@ -19,13 +19,8 @@ if isTrue ${REMOVE_OLD_MODS}; then
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# only try to remove existing mods dir
|
log "Removing old mods in $remove_mods_dest..."
|
||||||
if [ -d "$remove_mods_dest" ]; then
|
find $remove_mods_dest -mindepth 1 -maxdepth ${REMOVE_OLD_MODS_DEPTH:-16} -wholename "${REMOVE_OLD_MODS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_MODS_EXCLUDE}" -delete
|
||||||
log "Removing old mods in $remove_mods_dest..."
|
|
||||||
find $remove_mods_dest -mindepth 1 -maxdepth ${REMOVE_OLD_MODS_DEPTH:-16} -wholename "${REMOVE_OLD_MODS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_MODS_EXCLUDE}" -delete
|
|
||||||
else
|
|
||||||
log "Directory $remove_mods_dest does not exist; removing nothing."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If supplied with a URL for a modpack (simple zip of jars), download it and unpack
|
# If supplied with a URL for a modpack (simple zip of jars), download it and unpack
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
|
||||||
|
|
||||||
: ${PLUGINS_SYNC_UPDATE:=true}
|
|
||||||
|
|
||||||
isDebugging && set -x
|
|
||||||
|
|
||||||
if [ -d /plugins ]; then
|
|
||||||
case ${TYPE} in
|
|
||||||
SPIGOT|BUKKIT|PAPER|MAGMA)
|
|
||||||
mkdir -p /data/plugins
|
|
||||||
log "Copying plugins over..."
|
|
||||||
if isTrue ${PLUGINS_SYNC_UPDATE}; then
|
|
||||||
updateArg="--update"
|
|
||||||
fi
|
|
||||||
# Copy plugins over using rsync to allow deeply nested updates of plugins
|
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs $updateArg /plugins /data
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If any modules have been provided, copy them over
|
|
||||||
if [ -d /mods ]; then
|
|
||||||
log "Copying any mods over..."
|
|
||||||
mkdir -p /data/mods
|
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data
|
|
||||||
fi
|
|
||||||
|
|
||||||
: ${COPY_CONFIG_DEST:="/data/config"}
|
|
||||||
|
|
||||||
if [ -d /config ]; then
|
|
||||||
log "Copying any configs from /config to $COPY_CONFIG_DEST"
|
|
||||||
mkdir -p $COPY_CONFIG_DEST
|
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /config/ $COPY_CONFIG_DEST
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetupServerProperties $@
|
|
||||||
Executable
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
: ${PLUGINS_SYNC_UPDATE:=true}
|
||||||
|
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
if [ -d /plugins ]; then
|
||||||
|
case ${TYPE} in
|
||||||
|
SPIGOT|BUKKIT|PAPER)
|
||||||
|
mkdir -p /data/plugins
|
||||||
|
log "Copying plugins over..."
|
||||||
|
if isTrue ${PLUGINS_SYNC_UPDATE}; then
|
||||||
|
updateArg="--update"
|
||||||
|
fi
|
||||||
|
# Copy plugins over using rsync to allow deeply nested updates of plugins
|
||||||
|
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs $updateArg /plugins /data
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec ${SCRIPTS:-/}start-finalSetupServerProperties $@
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
: ${COPY_CONFIG_DEST:="/data/config"}
|
||||||
|
|
||||||
if [ -n "$OPS" ]; then
|
if [ -n "$OPS" ]; then
|
||||||
log "Setting/adding ops"
|
log "Setting/adding ops"
|
||||||
rm -rf /data/ops.txt.converted
|
rm -rf /data/ops.txt.converted
|
||||||
@@ -49,6 +51,20 @@ for j in $JSON_FILES; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# If any modules have been provided, copy them over
|
||||||
|
if [ -d /mods ]; then
|
||||||
|
log "Copying any mods over..."
|
||||||
|
mkdir -p /data/mods
|
||||||
|
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d /config ]; then
|
||||||
|
log "Copying any configs from /config to $COPY_CONFIG_DEST"
|
||||||
|
mkdir -p $COPY_CONFIG_DEST
|
||||||
|
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /config/ $COPY_CONFIG_DEST
|
||||||
|
fi
|
||||||
|
|
||||||
EXTRA_ARGS=""
|
EXTRA_ARGS=""
|
||||||
# Optional disable console
|
# Optional disable console
|
||||||
if versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then
|
if versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user