diff --git a/Dockerfile b/Dockerfile index e49218ff..12588e34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,12 +15,9 @@ RUN apk add --no-cache -U \ mysql-client \ tzdata \ rsync \ - nano \ - python python-dev py2-pip + nano -RUN pip install mcstatus yq - -HEALTHCHECK --start-period=1m CMD mcstatus localhost:$SERVER_PORT ping +HEALTHCHECK --start-period=1m CMD mc-monitor status --host localhost --port $SERVER_PORT RUN addgroup -g 1000 minecraft \ && adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \ @@ -41,11 +38,17 @@ RUN easy-add --file restify --from https://github.com/itzg/restify/releases/down ARG RCON_CLI_VER=1.4.7 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 +ARG MC_MONITOR_VER=0.1.6 +RUN easy-add --file mc-monitor --from https://github.com/itzg/mc-monitor/releases/download/v${MC_MONITOR_VER}/mc-monitor_${MC_MONITOR_VER}_Linux_${ARCH}.tar.gz + 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 +ARG MVN_META_REL_VER=0.1.0 +RUN easy-add --file maven-metadata-release --from https://github.com/itzg/maven-metadata-release/releases/download/v${MVN_META_REL_VER}/maven-metadata-release_${MVN_META_REL_VER}_linux_${ARCH}.tar.gz + COPY mcadmin.jq /usr/share -RUN chmod +x /usr/local/bin/* +COPY mcstatus /usr/local/bin VOLUME ["/data","/mods","/config"] COPY server.properties /tmp/server.properties diff --git a/docker-versions-create.sh b/docker-versions-create.sh index da0fcff1..3c3ad353 100755 --- a/docker-versions-create.sh +++ b/docker-versions-create.sh @@ -47,6 +47,9 @@ for branch in "${branches_list[@]}"; do exit 1; } proceed='False' while [[ "$proceed" == "False" ]]; do + # Ensure local branch is aligned with remote since docker-versions-create may have been run elsewhere + git pull + if git merge -m 'Auto-merging via docker-versions-create' master; then proceed="True" echo "Branch $branch updated to current master successfully" diff --git a/mcstatus b/mcstatus new file mode 100755 index 00000000..89c62d78 --- /dev/null +++ b/mcstatus @@ -0,0 +1,16 @@ +#!/bin/bash + +##### mcstatus shim for mc-monitor +# handles translating calls to +# mcstatus (host:port) (command) +# where the actual command is ignore, but is typically ping or status + +addr="$1" + +IFS=':' +read -a parts <<< "${addr}" +if [[ ${#parts[*]} -gt 1 ]]; then + exec mc-monitor status --host ${parts[0]} --port ${parts[1]} +else + exec mc-monitor status --host ${parts[0]} +fi diff --git a/start-deployFabric b/start-deployFabric index 13ace55b..ad6e1d7b 100644 --- a/start-deployFabric +++ b/start-deployFabric @@ -12,8 +12,7 @@ if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then echo "Checking Fabric version information." case $FABRICVERSION in LATEST) - curl -fsSL https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml | xq -c . > /tmp/fabric.json - FABRIC_VERSION=$(< /tmp/fabric.json jq -r ".metadata.versioning.release") + FABRIC_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml) ;; *) diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index 84c6a38c..6be24b95 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -31,7 +31,7 @@ fi echo "Checking for JSON files." JSON_FILES=$(find . -maxdepth 1 -name '*.json') for j in $JSON_FILES; do - if [[ $(python -c "print open('$j').read().strip()==''") = True ]]; then + if [[ $(cat $j | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') == "" ]]; then echo "Fixing JSON $j" echo '[]' > $j fi