modrinth: add support for default excludes/includes (#2937)

This commit is contained in:
Geoff Bourne 2024-06-30 15:15:44 -05:00 committed by GitHub
parent a933e92460
commit c70f9c3fff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 49 additions and 17 deletions

View file

@ -47,7 +47,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_HELPER_VERSION=1.39.1
ARG MC_HELPER_VERSION=1.39.2
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1

View file

@ -73,6 +73,10 @@ To force include client mods, set `MODRINTH_FORCE_INCLUDE_FILES` to a comma or n
yet-another-config-lib
```
## Default exclude/includes
The image comes with a default set of exclude/includes, maintained [in the repo files area](https://github.com/itzg/docker-minecraft-server/blob/master/files/modrinth-exclude-include.json) and uses the same [JSON schema](https://github.com/itzg/mc-image-helper?tab=readme-ov-file#excludeinclude-file-schema) as Auto CurseForge. Those defaults can be disabled by setting the env var `MODRINTH_DEFAULT_EXCLUDE_INCLUDES` to an empty string.
## Excluding Overrides Files
Modrinth mrpack/zip files may include an `overrides` subdirectory that contains config files, world data, and extra mod files. All of those files will be extracted into the `/data` path of the container. If any of those files, such as incompatible mods, need to be excluded from extraction, then the `MODRINTH_OVERRIDES_EXCLUSIONS` variable can be set with a comma or newline delimited list of ant-style paths ([see below](#ant-style-paths)) to exclude, relative to the overrides (or `/data`) directory.

View file

@ -2,22 +2,14 @@ services:
mc:
image: itzg/minecraft-server:java17
environment:
DEBUG: true
SETUP_ONLY: true
EULA: true
TYPE: MODRINTH
VERSION: 1.20.1
MEMORY: 4G
MODRINTH_MODPACK: better-mc-forge-bmc4
MODRINTH_VERSION: v26
MODRINTH_EXCLUDE_FILES: |
citresewn
oculus
yungsmenutweaks
notenoughanimations
ryoamiclights
euphoriapatcher
entity_model_features
entity_texture_features
3dskinlayers
connector
MODRINTH_VERSION: v28
MODRINTH_OVERRIDES_EXCLUSIONS: |
mods/NekosEnchantedBooks-*.jar
mods/citresewn-*.jar

View file

@ -0,0 +1,18 @@
services:
mc:
image: itzg/minecraft-server
ports:
- "25565:25565"
environment:
EULA: "true"
MOD_PLATFORM: AUTO_CURSEFORGE
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/prominence-2-rpg
CF_FILENAME_MATCHER: "2.8.7"
MEMORY: 4G
volumes:
- mc-data:/data
volumes:
mc-data: {}

View file

@ -0,0 +1,16 @@
{
"globalExcludes": [
"3dskinlayers",
"citresewn",
"connector",
"entity_model_features",
"entity_texture_features",
"euphoriapatcher",
"notenoughanimations",
"oculus",
"ryoamiclights",
"yungsmenutweaks"
],
"globalForceIncludes": [],
"modpacks": {}
}

View file

@ -9,10 +9,11 @@ resultsFile=/data/.install-modrinth.env
: "${MODRINTH_MODPACK:=${MODRINTH_PROJECT:-}}"
: "${MODRINTH_LOADER:=}"
: "${MODRINTH_VERSION:=${MODRINTH_VERSION_ID:-}}"
: "${MODRINTH_IGNORE_MISSING_FILES:=}"
: "${MODRINTH_EXCLUDE_FILES:=}"
: "${MODRINTH_FORCE_INCLUDE_FILES:=}"
: "${MODRINTH_OVERRIDES_EXCLUSIONS:=}"
: "${MODRINTH_IGNORE_MISSING_FILES=}"
: "${MODRINTH_EXCLUDE_FILES=}"
: "${MODRINTH_FORCE_INCLUDE_FILES=}"
: "${MODRINTH_OVERRIDES_EXCLUSIONS=}"
: "${MODRINTH_DEFAULT_EXCLUDE_INCLUDES=/image/modrinth-exclude-include.json}"
if [[ ! $MODRINTH_MODPACK ]]; then
log "ERROR: MODRINTH_MODPACK must be set when using TYPE/MOD_PLATFORM of MODRINTH"
@ -60,6 +61,7 @@ setArg --default-version-type MODRINTH_DEFAULT_VERSION_TYPE
setArg --exclude-files MODRINTH_EXCLUDE_FILES
setArg --force-include-files MODRINTH_FORCE_INCLUDE_FILES
setArg --overrides-exclusions MODRINTH_OVERRIDES_EXCLUSIONS
setArg --default-exclude-includes MODRINTH_DEFAULT_EXCLUDE_INCLUDES
if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then
log "ERROR failed to install Modrinth modpack"