Merge branch 'master' into openj9

This commit is contained in:
Geoff Bourne
2019-11-16 09:01:17 -06:00
11 changed files with 177 additions and 42 deletions
+12 -13
View File
@@ -20,7 +20,7 @@ RUN apk add --no-cache -U \
RUN pip install mcstatus yq RUN pip install mcstatus yq
HEALTHCHECK CMD mcstatus localhost:$SERVER_PORT ping HEALTHCHECK --start-period=1m CMD mcstatus localhost:$SERVER_PORT ping
RUN addgroup -g 1000 minecraft \ RUN addgroup -g 1000 minecraft \
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \ && adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
@@ -31,22 +31,20 @@ EXPOSE 25565 25575
RUN echo 'hosts: files dns' > /etc/nsswitch.conf RUN echo 'hosts: files dns' > /etc/nsswitch.conf
ARG RESTIFY_VER=1.1.6
ARG RCON_CLI_VER=1.4.6
ARG MC_SERVER_RUNNER_VER=1.3.2
ARG ARCH=amd64 ARG ARCH=amd64
ADD https://github.com/itzg/restify/releases/download/${RESTIFY_VER}/restify_${RESTIFY_VER}_linux_${ARCH}.tar.gz /tmp/restify.tgz ARG EASY_ADD_VER=0.3.0
RUN tar -x -C /usr/local/bin -f /tmp/restify.tgz restify && \ ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${EASY_ADD_VER}_linux_${ARCH} /usr/bin/easy-add
rm /tmp/restify.tgz RUN chmod +x /usr/bin/easy-add
ADD https://github.com/itzg/rcon-cli/releases/download/${RCON_CLI_VER}/rcon-cli_${RCON_CLI_VER}_linux_${ARCH}.tar.gz /tmp/rcon-cli.tgz ARG RESTIFY_VER=1.2.1
RUN tar -x -C /usr/local/bin -f /tmp/rcon-cli.tgz rcon-cli && \ RUN easy-add --file restify --from https://github.com/itzg/restify/releases/download/${RESTIFY_VER}/restify_${RESTIFY_VER}_linux_${ARCH}.tar.gz
rm /tmp/rcon-cli.tgz
ADD https://github.com/itzg/mc-server-runner/releases/download/${MC_SERVER_RUNNER_VER}/mc-server-runner_${MC_SERVER_RUNNER_VER}_linux_${ARCH}.tar.gz /tmp/mc-server-runner.tgz ARG RCON_CLI_VER=1.4.7
RUN tar -x -C /usr/local/bin -f /tmp/mc-server-runner.tgz mc-server-runner && \ RUN easy-add --file rcon-cli --from https://github.com/itzg/rcon-cli/releases/download/${RCON_CLI_VER}/rcon-cli_${RCON_CLI_VER}_linux_${ARCH}.tar.gz
rm /tmp/mc-server-runner.tgz
ARG MC_RUN_VER=1.3.3
RUN easy-add --file mc-server-runner --from https://github.com/itzg/mc-server-runner/releases/download/${MC_RUN_VER}/mc-server-runner_${MC_RUN_VER}_linux_${ARCH}.tar.gz
COPY mcadmin.jq /usr/share COPY mcadmin.jq /usr/share
RUN chmod +x /usr/local/bin/* RUN chmod +x /usr/local/bin/*
@@ -61,6 +59,7 @@ ENV UID=1000 GID=1000 \
MEMORY="1G" \ MEMORY="1G" \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \ TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \ PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
RESOURCE_PACK= RESOURCE_PACK_SHA1= \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true SERVER_NAME="Dedicated Server" \ LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= MODS= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true SERVER_NAME="Dedicated Server" \
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_" REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_"
+22 -1
View File
@@ -9,6 +9,8 @@ This docker image provides a Minecraft Server that will automatically download t
version at startup. You can also run/upgrade to any specific version or the version at startup. You can also run/upgrade to any specific version or the
latest snapshot. See the *Versions* section below for more information. latest snapshot. See the *Versions* section below for more information.
[![Click for more docs](https://i.imgur.com/jS02ebD.png)](https://github.com/itzg/docker-minecraft-server/blob/master/README.md)
To simply use the latest stable version, run To simply use the latest stable version, run
docker run -d -p 25565:25565 --name mc itzg/minecraft-server docker run -d -p 25565:25565 --name mc itzg/minecraft-server
@@ -238,6 +240,9 @@ There are some limitations to what characters you can use.
| Name | `0-9a-zA-Z_-` | | Name | `0-9a-zA-Z_-` |
| Value | `0-9a-zA-Z_-:/=?.+` | | Value | `0-9a-zA-Z_-:/=?.+` |
Variables will be replaced in files with the following extensions:
`.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`.
Here is a full example where we want to replace values inside a `database.yml`. Here is a full example where we want to replace values inside a `database.yml`.
```yml ```yml
@@ -822,6 +827,12 @@ Determines if villagers will be spawned.
docker run -d -e SPAWN_NPCS=true docker run -d -e SPAWN_NPCS=true
### Set spawn protection
Sets the area that non-ops can not edit (0 to disable)
docker run -d -e SPAWN_PROTECTION=0
### View Distance ### View Distance
Sets the amount of world data the server sends the client, measured in chunks in each direction of the player (radius, not diameter). Sets the amount of world data the server sends the client, measured in chunks in each direction of the player (radius, not diameter).
It determines the server-side viewing distance. It determines the server-side viewing distance.
@@ -894,6 +905,14 @@ For example (just the `-e` bits):
-e LEVEL_TYPE=flat -e 'GENERATOR_SETTINGS=3;minecraft:bedrock,3*minecraft:stone,52*minecraft:sandstone;2;' -e LEVEL_TYPE=flat -e 'GENERATOR_SETTINGS=3;minecraft:bedrock,3*minecraft:stone,52*minecraft:sandstone;2;'
### Custom Server Resource Pack
You can set a link to a custom resource pack and set it's checksum using the `RESOURCE_PACK` and `RESOURCE_PACK_SHA1` options respectively, the default is blank:
docker run -d -e 'RESROUCE_PACK=http\://link.com/to/pack.zip?\=1' -e 'RESOURCE_PACK_SHA1=d5db29cd03a2ed055086cef9c31c252b4587d6d0'
**NOTE:** `:` and `=` must be escaped using `\`. The checksum plain-text hexadecimal.
### World Save Name ### World Save Name
You can either switch between world saves or run multiple containers with different saves by using the `LEVEL` option, You can either switch between world saves or run multiple containers with different saves by using the `LEVEL` option,
@@ -1004,7 +1023,9 @@ ways to adjust the memory settings:
* `MAX_MEMORY`, independently sets the max heap size * `MAX_MEMORY`, independently sets the max heap size
The values of all three are passed directly to the JVM and support format/units as The values of all three are passed directly to the JVM and support format/units as
`<size>[g|G|m|M|k|K]`. `<size>[g|G|m|M|k|K]`. For example:
-e MEMORY=2G
### JVM Options ### JVM Options
+71
View File
@@ -0,0 +1,71 @@
#!/bin/bash
#set -x
# Use this variable to indicate a list of branches that docker hub is watching
branches_list=('openj9' 'openj9-nightly')
function TrapExit {
echo "Checking out back in master"
git checkout master
}
trap TrapExit EXIT SIGTERM
test -d ./.git || { echo ".git folder was not found. Please start this script from root directory of the project!";
exit 1; }
# Making sure we are in master
git checkout master
git pull --all || { echo "Can't pull the repo!"; \
exit 1; }
git_branches=$(git branch -a)
for branch in "${branches_list[@]}"; do
if [[ "$git_branches" != *"$branch"* ]]; then
echo "Can't update $branch because I can't find it in the list of branches."
exit 1
else
echo "Branch $branch found. Working with it."
git checkout "$branch" || { echo "Can't checkout into the branch. Don't know the cause."; \
exit 1; }
proceed='False'
while [[ "$proceed" == "False" ]]; do
if git merge master; then
proceed="True"
echo "Branch $branch updated to current master successfully"
# pushing changes to remote for this branch
git commit -m "Auto merge branch with master" -a
# push may fail if remote doesn't have this branch yet. In this case - sending branch
git push || git push -u origin "$branch" || { echo "Can't push changes to the origin."; exit 1; }
else
cat<<EOL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Master merge in the branch $branch encountered an error!
You may try to fix the error and merge again. (Commit changes)
Or skip this branch merge completely.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EOL
printf "Should we try again? (y):"
read answer
if [[ "$answer" == '' ]] || [[ "$answer" == 'y' ]] || [[ "$answer" == 'Y' ]]; then
# If you use non-local editor or files are changed in repo
cat <<EOL
The following commands may encounter an error!
This is completely fine if the changes were made locally and remote branch doesn't know about them.
EOL
# Updating branch from remote before trying again
git checkout master
git fetch --all
git pull -a
git checkout "$branch"
continue
else
break
fi
fi
done
fi
done
+10 -8
View File
@@ -6,14 +6,8 @@ shopt -s nullglob
export HOME=/data export HOME=/data
if [ ! -e /data/eula.txt ]; then if [ ! -e /data/eula.txt ]; then
if [ "$EULA" != "" ]; then EULA="${EULA,,}"
echo "# Generated via Docker on $(date)" > eula.txt if [ "$EULA" != "true" ]; then
echo "eula=$EULA" >> eula.txt
if [ $? != 0 ]; then
echo "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
exit 2
fi
else
echo "" echo ""
echo "Please accept the Minecraft EULA at" echo "Please accept the Minecraft EULA at"
echo " https://account.mojang.com/documents/minecraft_eula" echo " https://account.mojang.com/documents/minecraft_eula"
@@ -22,8 +16,16 @@ if [ ! -e /data/eula.txt ]; then
echo "" echo ""
exit 1 exit 1
fi fi
echo "# Generated via Docker on $(date)" > eula.txt
echo "eula=$EULA" >> eula.txt
if [ $? != 0 ]; then
echo "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
exit 2
fi
fi fi
echo "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'" echo "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
if ! touch /data/.verify_access; then if ! touch /data/.verify_access; then
+10 -3
View File
@@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -u set -eu
. /start-utils
export TYPE=FABRIC export TYPE=FABRIC
@@ -28,8 +30,9 @@ elif [[ ! -e $FABRIC_INSTALLER ]]; then
exit 2 exit 2
fi fi
installMarker=".fabric-installed-${FABRIC_VERSION:-manual}" installMarker=".fabric-installed-${VANILLA_VERSION}-${FABRIC_VERSION:-manual}"
debug Checking for installMarker ${installMarker}
if [[ ! -e $installMarker ]]; then if [[ ! -e $installMarker ]]; then
if [[ ! -e $FABRIC_INSTALLER ]]; then if [[ ! -e $FABRIC_INSTALLER ]]; then
if [[ -z $FABRIC_INSTALLER_URL ]]; then if [[ -z $FABRIC_INSTALLER_URL ]]; then
@@ -46,7 +49,11 @@ if [[ ! -e $installMarker ]]; then
fi fi
fi fi
echo "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER" if isDebugging; then
debug "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER with mcversion ${VANILLA_VERSION}"
else
echo "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER"
fi
tries=3 tries=3
set +e set +e
while ((--tries >= 0)); do while ((--tries >= 0)); do
+4 -4
View File
@@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
export SERVER=paper_server.jar export SERVER=paper_server-${VANILLA_VERSION}.jar
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/latest/download} downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/latest/download}
echo "Downloading Paper $VANILLA_VERSION from $downloadUrl ..." echo "Downloading Paper $VANILLA_VERSION from $downloadUrl ..."
curl -fsSL -o $SERVER "$downloadUrl" curl -fsSL -o "$SERVER" "$downloadUrl"
if [ ! -f $SERVER ]; then if [ ! -f "$SERVER" ]; then
echo "ERROR: failed to download from $downloadUrl (status=$?)" echo "ERROR: failed to download from $downloadUrl (status=$?)"
exit 3 exit 3
fi fi
+25
View File
@@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
set -e
. /start-utils
# CURSE_URL_BASE used in manifest downloads below # CURSE_URL_BASE used in manifest downloads below
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects} CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
@@ -106,4 +110,25 @@ case "X$EFFECTIVE_MANIFEST_URL" in
esac esac
fi fi
if [[ "${GENERIC_PACK}" ]]; then
if isURL "${GENERIC_PACK}"; then
generic_pack_url=${GENERIC_PACK}
GENERIC_PACK=/tmp/$(basename ${generic_pack_url})
echo "Downloading generic pack from ${generic_pack_url} ..."
curl -fsSL -o ${GENERIC_PACK} ${generic_pack_url}
fi
sum_file=/data/.generic_pack.sum
if ! sha256sum -c ${sum_file} -s 2> /dev/null; then
base_dir=/tmp/generic_pack_base
mkdir -p ${base_dir}
unzip -q -d ${base_dir} ${GENERIC_PACK}
depth=$(( ${GENERIC_PACK_STRIP_DIRS:-1} + 1 ))
echo "Applying generic pack, stripping $(( depth - 1 )) level ..."
find ${base_dir} -type d -mindepth $depth -maxdepth $depth -exec cp -r {} /data/ +
rm -rf ${base_dir}
sha256sum ${GENERIC_PACK} > ${sum_file}
fi
fi
exec /start-finalSetup03Modconfig $@ exec /start-finalSetup03Modconfig $@
+3
View File
@@ -49,6 +49,7 @@ function customizeServerProps {
setServerProp "spawn-animals" "$SPAWN_ANIMALS" setServerProp "spawn-animals" "$SPAWN_ANIMALS"
setServerProp "spawn-monsters" "$SPAWN_MONSTERS" setServerProp "spawn-monsters" "$SPAWN_MONSTERS"
setServerProp "spawn-npcs" "$SPAWN_NPCS" setServerProp "spawn-npcs" "$SPAWN_NPCS"
setServerProp "spawn-protection" "$SPAWN_PROTECTION"
setServerProp "generate-structures" "$GENERATE_STRUCTURES" setServerProp "generate-structures" "$GENERATE_STRUCTURES"
setServerProp "view-distance" "$VIEW_DISTANCE" setServerProp "view-distance" "$VIEW_DISTANCE"
setServerProp "hardcore" "$HARDCORE" setServerProp "hardcore" "$HARDCORE"
@@ -70,6 +71,8 @@ function customizeServerProps {
setServerProp "online-mode" "$ONLINE_MODE" setServerProp "online-mode" "$ONLINE_MODE"
setServerProp "allow-flight" "$ALLOW_FLIGHT" setServerProp "allow-flight" "$ALLOW_FLIGHT"
setServerProp "level-type" "${LEVEL_TYPE^^}" setServerProp "level-type" "${LEVEL_TYPE^^}"
setServerProp "resource-pack" "$RESOURCE_PACK"
setServerProp "resource-pack-sha1" "$RESOURCE_PACK_SHA1"
if [ -n "$DIFFICULTY" ]; then if [ -n "$DIFFICULTY" ]; then
case $DIFFICULTY in case $DIFFICULTY in
+9 -4
View File
@@ -1,13 +1,18 @@
#!/bin/bash #!/bin/bash
if [ "$REPLACE_ENV_VARIABLES" = "TRUE" ]; then if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
echo "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..." echo "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
while IFS='=' read -r name value ; do while IFS='=' read -r name value ; do
# check if name of env variable matches the prefix # check if name of env variable matches the prefix
# sanity check environment variables to avoid code injections # sanity check environment variables to avoid code injections
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] && [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] && [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
echo "Replacing $name with $value ..." && [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
find /data/ -type f \( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" -or -name "*.properties" \) -exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \; && [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
echo "Replacing $name with $value ..."
find /data/ -type f \
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
-or -name "*.conf" -or -name "*.properties" \) \
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
fi fi
done < <(env) done < <(env)
fi fi
+8 -6
View File
@@ -2,14 +2,16 @@
. /start-utils . /start-utils
if [ -n "$OPS" -a ! -e ops.txt.converted ]; then if [ -n "$OPS" ]; then
echo "Setting ops" echo "Setting/adding ops"
echo $OPS | awk -v RS=, '{print}' >> ops.txt rm -rf ops.txt.converted
echo $OPS | awk -v RS=, '{print}' > ops.txt
fi fi
if [ -n "$WHITELIST" -a ! -e white-list.txt.converted ]; then if [ -n "$WHITELIST" ]; then
echo "Setting whitelist" echo "Setting whitelist"
echo $WHITELIST | awk -v RS=, '{print}' >> white-list.txt rm -rf white-list.txt.converted
echo $WHITELIST | awk -v RS=, '{print}' > white-list.txt
fi fi
if [ -n "$ICON" -a ! -e server-icon.png ]; then if [ -n "$ICON" -a ! -e server-icon.png ]; then
@@ -117,7 +119,7 @@ if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
cat > "${FTB_DIR}/settings-local.sh" <<EOF cat > "${FTB_DIR}/settings-local.sh" <<EOF
export MIN_RAM="${INIT_MEMORY}" export MIN_RAM="${INIT_MEMORY}"
export MAX_RAM="${MAX_MEMORY}" export MAX_RAM="${MAX_MEMORY}"
export JAVA_PARAMETERS="-Xms${INIT_MEMORY} $expandedDOpts" export JAVA_PARAMETERS="${JVM_XX_OPTS} -Xms${INIT_MEMORY} ${JVM_OPTS} $expandedDOpts"
EOF EOF
# patch CurseForge cfg file, if present # patch CurseForge cfg file, if present
+1 -1
View File
@@ -28,7 +28,7 @@ function isTrue {
} }
function isDebugging { function isDebugging {
if [[ ${DEBUG^^} = TRUE ]]; then if [[ -v DEBUG ]] && [[ ${DEBUG^^} = TRUE ]]; then
return 0 return 0
else else
return 1 return 1