Compare commits

...

12 Commits

Author SHA1 Message Date
Geoff Bourne
cf1dd9f9e1 Corrected default of UID/GID via start script (#1471)
Fixes #1469
2022-04-11 18:00:16 -05:00
Geoff Bourne
8ef3fe199f Allow ICON to reference a local file (#1466) 2022-04-10 11:39:58 -05:00
Geoff Bourne
97fe6b1f14 Corrected autopause's resume to work with alpine images (#1464) 2022-04-10 10:58:18 -05:00
Geoff Bourne
4af80debe2 Correct spiget handling of jars that contain jars (#1462) 2022-04-09 22:02:20 -05:00
itzg
513492192b docs: Auto update markdown TOC 2022-04-02 20:38:29 +00:00
Geoff Bourne
e0b4a819b1 Fixed version comparisons when using SPONGEVANILLA (#1455)
Fixes #1452
2022-04-02 15:38:13 -05:00
itzg
5c0cf11bfe docs: Auto update markdown TOC 2022-04-02 19:02:45 +00:00
Michael Vorburger ⛑️
63a884ea75 Add hint that SPONGEVANILLA requires VERSION to README (#1452) (#1453) 2022-04-02 14:02:29 -05:00
chblodg
7c7090a582 ForgeAPI fixed lower sub version with a higher ID number (#1451)
Co-authored-by: christopher blodgett <christopher.blodgett@gmail.com>
2022-04-01 18:26:12 -05:00
dependabot[bot]
fc70a976bd build(deps): bump docker/build-push-action from 2.9.0 to 2.10.0 (#1438) 2022-03-22 20:52:32 -05:00
itzg
0de90b134c docs: Auto update markdown TOC 2022-03-23 00:23:06 +00:00
Nick Martin
6eca74698b Update README.md (#1442) 2022-03-22 19:22:49 -05:00
31 changed files with 151 additions and 43 deletions

View File

@@ -116,7 +116,7 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build for test
uses: docker/build-push-action@v2.9.0
uses: docker/build-push-action@v2.10.0
with:
platforms: linux/amd64
tags: ${{ env.IMAGE_TO_TEST }}
@@ -140,7 +140,7 @@ jobs:
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2.9.0
uses: docker/build-push-action@v2.10.0
with:
platforms: ${{ matrix.platforms }}
push: ${{ github.ref_type == 'tag' || github.ref_name == 'master' }}

View File

@@ -27,7 +27,7 @@ jobs:
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2.9.0
uses: docker/build-push-action@v2.10.0
with:
context: .
platforms: linux/amd64

View File

@@ -23,7 +23,7 @@ jobs:
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2.9.0
uses: docker/build-push-action@v2.10.0
with:
context: .
platforms: linux/amd64
@@ -55,7 +55,7 @@ jobs:
- name: Push
if: contains(github.event.pull_request.labels.*.name, 'ci/push-image')
uses: docker/build-push-action@v2.9.0
uses: docker/build-push-action@v2.10.0
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64

View File

@@ -57,13 +57,7 @@ WORKDIR /data
STOPSIGNAL SIGTERM
ENV UID=1000 GID=1000 \
MEMORY="1G" \
TYPE=VANILLA VERSION=LATEST \
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0 \
ENABLE_AUTOSTOP=false AUTOSTOP_TIMEOUT_EST=3600 AUTOSTOP_TIMEOUT_INIT=1800 AUTOSTOP_PERIOD=10
ENV TYPE=VANILLA VERSION=LATEST EULA=""
COPY --chmod=755 scripts/start* /
COPY --chmod=755 bin/ /usr/local/bin/

View File

@@ -151,7 +151,8 @@ By default, the container will download the latest version of the "vanilla" [Min
* [Running on RaspberryPi](#running-on-raspberrypi)
* [Contributing](#contributing)
<!-- Added by: runner, at: Wed Mar 16 00:48:32 UTC 2022 -->
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
<!-- Added by: runner, at: Sat Apr 2 20:38:28 UTC 2022 -->
<!--te-->
@@ -608,7 +609,7 @@ Enable SpongeVanilla server mode by adding a `-e TYPE=SPONGEVANILLA` to your com
By default the container will run the latest `STABLE` version.
If you want to run a specific version, you can add `-e SPONGEVERSION=1.11.2-6.1.0-BETA-19` to your command-line.
Beware that current [Sponge](https://www.spongepowered.org) `STABLE` versions for Minecraft 1.12 require using [the Java 8 tag](#running-minecraft-server-on-different-java-version):
docker run -d -v /path/on/host:/data -e TYPE=SPONGEVANILLA \
@@ -1663,7 +1664,7 @@ To also include the timestamp with each log, set `LOG_TIMESTAMP` to "true". The
Feature is used run commands when the server starts, client connects, or client disconnects.
**Notes:**
* On clinet connect we only know there was a connection, and not who connected. RCON commands will need to be used for that.
* On client connect we only know there was a connection, and not who connected. RCON commands will need to be used for that.
* Using '|-' is preferred for yaml, this make sure only the correct new lines are in place for the commands.
**On Server Start:**

View File

@@ -3,13 +3,13 @@
[unpauseMCServer-server]
sequence = 25565
seq_timeout = 1
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
command = /autopause/resume.sh
tcpflags = syn
[unpauseMCServer-rcon]
sequence = 25575
seq_timeout = 1
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
command = /autopause/resume.sh
tcpflags = syn
[unpauseMCServer-bedrock]
sequence = 19132:udp
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
command = /autopause/resume.sh

View File

@@ -3,6 +3,9 @@
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
: "${UID:=1000}"
: "${GID:=1000}"
umask 0002
chmod g+w /data

View File

@@ -4,7 +4,19 @@
. "${SCRIPTS:-/}start-utils"
: "${SERVER_PORT:=25565}"
: "${ENABLE_AUTOPAUSE:=false}"
: "${AUTOPAUSE_TIMEOUT_EST:=3600}"
: "${AUTOPAUSE_TIMEOUT_KN:=120}"
: "${AUTOPAUSE_TIMEOUT_INIT:=600}"
: "${AUTOPAUSE_PERIOD:=10}"
: "${AUTOPAUSE_KNOCK_INTERFACE:=eth0}"
export SERVER_PORT
export ENABLE_AUTOPAUSE
export AUTOPAUSE_TIMEOUT_EST
export AUTOPAUSE_TIMEOUT_KN
export AUTOPAUSE_TIMEOUT_INIT
export AUTOPAUSE_PERIOD
export AUTOPAUSE_KNOCK_INTERFACE
log "Autopause functionality enabled"

View File

@@ -4,7 +4,15 @@
. "${SCRIPTS:-/}start-utils"
: "${SERVER_PORT:=25565}"
: "${ENABLE_AUTOSTOP:=false}"
: "${AUTOSTOP_TIMEOUT_EST:=3600}"
: "${AUTOSTOP_TIMEOUT_INIT:=1800}"
: "${AUTOSTOP_PERIOD:=10}"
export SERVER_PORT
export ENABLE_AUTOSTOP
export AUTOSTOP_TIMEOUT_EST
export AUTOSTOP_TIMEOUT_INIT
export AUTOSTOP_PERIOD
log "Autostop functionality enabled"

View File

@@ -7,13 +7,18 @@ IFS=$'\n\t'
: "${EULA:=}"
: "${PROXY:=}"
: "${RCON_PASSWORD_FILE:=}"
: "${ENABLE_AUTOPAUSE:=false}"
: "${ENABLE_AUTOSTOP:=false}"
: "${RCON_CMDS_STARTUP:=}"
: "${RCON_CMDS_ON_CONNECT:=}"
: "${RCON_CMDS_ON_DISCONNECT:=}"
: "${RCON_CMDS_FIRST_CONNECT:=}"
: "${RCON_CMDS_LAST_DISCONNECT:=}"
: "${RCON_CMDS_PERIOD:=10}"
: "${RCON_PASSWORD_FILE:=}"
: "${RCON_PASSWORD:=minecraft}"
: "${RCON_PORT:=25575}"
export RCON_PASSWORD RCON_PORT
shopt -s nullglob

View File

@@ -24,12 +24,14 @@ esac
if [ -z $SPONGEVERSION ]; then
log "Choosing Version for Sponge"
if [ "$SPONGEBRANCH" == "stable" ]; then
export SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.stable.latest.version'`
SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.stable.latest.version'`
else
export SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.bleeding.latest.version'`
SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.bleeding.latest.version'`
fi
fi
VANILLA_VERSION="$SPONGEVERSION"
export VANILLA_VERSION
export SERVER="spongevanilla-$SPONGEVERSION.jar"
if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then

View File

@@ -7,20 +7,33 @@ isDebugging && set -x
if [ -n "$ICON" ]; then
if [ ! -e server-icon.png ] || isTrue "${OVERRIDE_ICON}"; then
log "Using server icon from $ICON..."
# Not sure what it is yet...call it "img"
if ! get -o /tmp/icon.img "$ICON"; then
log "ERROR: failed to download icon from $ICON"
if isURL "$ICON"; then
# Not sure what it is yet...call it "img"
if ! get -o /tmp/icon.img "$ICON"; then
log "ERROR: failed to download icon from $ICON"
exit 1
fi
ICON=/tmp/icon.img
iconSrc="url"
elif [ -f "$ICON" ]; then
iconSrc="file"
else
log "ERROR: $ICON does not appear to be a URL or existing file"
exit 1
fi
read -r -a specs < <(identify /tmp/icon.img | awk 'NR == 1 { print $2, $3 }')
read -r -a specs < <(identify "$ICON" | awk 'NR == 1 { print $2, $3 }')
if [ "${specs[0]} ${specs[1]}" = "PNG 64x64" ]; then
mv /tmp/icon.img /data/server-icon.png
if [ $iconSrc = url ]; then
mv -f /tmp/icon.img /data/server-icon.png
else
cp -f "$ICON" /data/server-icon.png
fi
elif [ "${specs[0]}" = GIF ]; then
log "Converting GIF image to 64x64 PNG..."
convert "/tmp/icon.img[0]" -resize 64x64! /data/server-icon.png
convert "$ICON"[0] -resize 64x64! /data/server-icon.png
else
log "Converting image to 64x64 PNG..."
convert /tmp/icon.img -resize 64x64! /data/server-icon.png
convert "$ICON" -resize 64x64! /data/server-icon.png
fi
fi
fi
@@ -97,6 +110,7 @@ if [[ ${GUI,,} = false ]]; then
EXTRA_ARGS+=" nogui"
fi
: "${MEMORY:=1G}"
: "${INIT_MEMORY:=${MEMORY}}"
: "${MAX_MEMORY:=${MEMORY}}"

View File

@@ -57,7 +57,7 @@ updateReleaseNumber(){
}
retrieveVersionTypeNumber(){
VERSION_NAME="Minecraft ${VANILLA_VERSION%.*}"
VERSION_NAME="Minecraft ${MAJOR_VANILLA_VERSION}"
minecraft_types=$(curl -X GET -s \
"${FORGEAPI_BASE_URL}/games/${MINECRAFT_GAME_ID}/version-types" \
-H 'Accept: application/json' -H 'x-api-key: '${MODS_FORGEAPI_KEY}'')
@@ -77,7 +77,7 @@ retrieveVersionTypeNumber(){
}
modFileByProjectID(){
project_id=$(echo $1 | tr -d '"')
project_id=$(echo "$1" | tr -d '"')
project_id_release_type=$2
project_id_file_name=$3
unset PROJECT_FILE
@@ -120,12 +120,12 @@ modFileByProjectID(){
.data | map(select(.fileName<=($FILE_NAME))) | .[0] // empty')
elif $( ! isTrue "$MODS_FORGEAPI_IGNORE_GAMETYPE" ) && $FILTER_BY_FAMILY ; then
# Looks for file by version and server type in lowercase
current_project_file=$(jq -n "$project_files" | jq --arg RELEASE_FILTER "$RELEASE_NUMBER_FILTER" --arg GAME_TYPE ${FAMILY,,} -jc '
.data | sort_by(.id) | reverse | map(select(.gameVersions[] | ascii_downcase | contains ($GAME_TYPE))) | map(select(.releaseType<=($RELEASE_FILTER|tonumber))) | .[0] // empty')
current_project_file=$(jq -n "$project_files" | jq --arg RELEASE_FILTER "$RELEASE_NUMBER_FILTER" --arg GAME_TYPE "${FAMILY,,}" --arg VERSION "$VANILLA_VERSION" -jc '
.data | sort_by(.id) | reverse | map(select(.gameVersions[] | ascii_downcase | contains ($GAME_TYPE))) | map(select(.gameVersions[] | contains ($VERSION))) | map(select(.releaseType<=($RELEASE_FILTER|tonumber))) | .[0] // empty')
else
# Looks for file by version only.
current_project_file=$(jq -n "$project_files" | jq --arg RELEASE_FILTER "$RELEASE_NUMBER_FILTER" -jc '
.data | sort_by(.id) | reverse | map(select(.releaseType<=($RELEASE_FILTER|tonumber))) | .[0] // empty')
current_project_file=$(jq -n "$project_files" | jq --arg RELEASE_FILTER "$RELEASE_NUMBER_FILTER" --arg VERSION "$VANILLA_VERSION" -jc '
.data | sort_by(.id) | reverse | map(select(.gameVersions[] | contains ($VERSION))) | map(select(.releaseType<=($RELEASE_FILTER|tonumber))) | .[0] // empty')
fi
# Logic to grab the latest release over the entire pagination

View File

@@ -4,6 +4,7 @@
. "${SCRIPTS:-/}start-utils"
: "${SERVER_PROPERTIES:=/data/server.properties}"
: "${ENABLE_RCON:=true}"
# FUNCTIONS
function setServerPropValue {

View File

@@ -101,13 +101,13 @@ downloadResourceFromSpiget() {
log "ERROR: failed to retrieve file type of resource $resource"
exit 1
fi
if containsJars "${outfile}"; then
if containsPlugin "${outfile}"; then
log "Moving resource ${resource} into plugins"
mv "$outfile" /data/plugins
elif containsJars "${outfile}"; then
log "Extracting contents of resource ${resource} into plugins"
extract "$outfile" /data/plugins
rm "$outfile"
elif containsPlugin "${outfile}"; then
log "Moving resource ${resource} into plugins"
mv "$outfile" /data/plugins
else
log "ERROR: file for resource ${resource} has an unexpected file type: ${fileType}"
exit 2

View File

@@ -0,0 +1,11 @@
version: "3"
services:
mc:
restart: "no"
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
volumes:
- ./data:/data

View File

@@ -0,0 +1,3 @@
mc-image-helper assert propertyEquals --file=server.properties --property=rcon.password --expect=minecraft
mc-image-helper assert propertyEquals --file=server.properties --property=rcon.port --expect=25575
mc-image-helper assert propertyEquals --file=server.properties --property=enable-rcon --expect=true

View File

@@ -16,7 +16,7 @@ services:
VERSION: ${MINECRAFT_VERSION:-LATEST}
MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES: "TRUE"
# Contains mix of Forge and Fabric mods
MODS_FORGEAPI_PROJECTIDS: 306612,416089,220318
MODS_FORGEAPI_PROJECTIDS: 416089,419697
# Allows for Beta releases of 416089 the Fabric Voice Mod
MODS_FORGEAPI_RELEASES: BETA
MODS_FORGEAPI_KEY: ${MODS_FORGEAPI_KEY}

View File

@@ -1,5 +1,6 @@
# No family filter applied, DO NOT use Fabric or Forge specific name validation as it may cause random breakage.
mc-image-helper assert fileExists "/data/mods/BiomesOPlenty*"
mc-image-helper assert fileExists "/data/mods/TerraBlender*"
mc-image-helper assert fileExists "/data/mods/voicechat*"
mc-image-helper assert fileExists "/data/mods/voicechat-fabric-1*"
# Should be pull v4 and higher for 1.18.2:
mc-image-helper assert fileExists "/data/mods/architectury-4*"
mc-image-helper assert fileExists "/data/mods/fabric-api*"

View File

@@ -0,0 +1,17 @@
version: "3"
services:
mc:
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "true"
SETUP_ONLY: "true"
ICON: /extra/4737386_minecraft_squircle_icon_64x64.png
# the following are only used to speed up test execution
TYPE: CUSTOM
CUSTOM_SERVER: /servers/fake.jar
VERSION: 1.18.1
volumes:
- ./data:/data
- ./extra:/extra
- ./fake.jar:/servers/fake.jar

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
mc-image-helper assert fileExists server-icon.png

View File

@@ -0,0 +1,17 @@
version: "3"
services:
mc:
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "true"
SETUP_ONLY: "true"
ICON: /extra/4737386_minecraft_squircle_icon.png
# the following are only used to speed up test execution
TYPE: CUSTOM
CUSTOM_SERVER: /servers/fake.jar
VERSION: 1.18.1
volumes:
- ./data:/data
- ./extra:/extra
- ./fake.jar:/servers/fake.jar

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1 @@
mc-image-helper assert fileExists server-icon.png

View File

@@ -8,6 +8,6 @@ services:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
TYPE: PAPER
SPIGET_RESOURCES: "34315,3836,6245,2124"
SPIGET_RESOURCES: "34315,3836,6245,2124,88135"
volumes:
- ./data:/data

View File

@@ -1,4 +1,5 @@
mc-image-helper assert fileExists plugins/3836.jar
mc-image-helper assert fileExists plugins/34315.jar
mc-image-helper assert fileExists plugins/6245.jar
mc-image-helper assert fileExists plugins/88135.jar
mc-image-helper assert fileExists plugins/SkinsRestorer.jar

View File

@@ -0,0 +1,15 @@
version: "3"
services:
mc:
restart: "no"
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
TYPE: "SPONGEVANILLA"
SPONGEVERSION: "1.12.2-7.3.1-RC391"
DIFFICULTY: "0"
volumes:
- ./data:/data

View File

@@ -0,0 +1 @@
mc-image-helper assert propertyEquals --file=server.properties --property=difficulty --expect=0