Support multiple values for COPY_PLUGINS_SRC, COPY_MODS_SRC, and COPY_CONFIG_SRC (#3377)

This commit is contained in:
Geoff Bourne
2025-03-23 15:43:08 -05:00
committed by GitHub
parent 231ac0f665
commit dac388268f
10 changed files with 34 additions and 14 deletions

View File

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

View File

@@ -16,7 +16,9 @@ On the left, there are sections describing some download automation options.
## Mods vs Plugins ## Mods vs Plugins
The terms "mods" and "plugins" can be quite confusing. Generally, the rule of thumb is that "mods" are used by the types that run client side to modify rendering, add new blocks, and add behaviors server, such as [Forge](../types-and-platforms/server-types/forge.md) and [Fabric](../types-and-platforms/server-types/fabric.md). "Plugins" are used by the types that **only run on servers** to add behaviors, commands, etc such as [Paper](../types-and-platforms/server-types/paper.md) (which derives from [Bukkit/Spigot](../types-and-platforms/server-types/bukkit-spigot.md)). There are also some types that are [hybrids](../types-and-platforms/server-types/hybrids.md), such as Magma, that use both "mods" and "plugins" The terms "mods" and "plugins" can be quite confusing. Generally, the rule of thumb is that "mods" are used by the types that run client side to modify rendering, add new blocks, and add behaviors server, such as [Forge](../types-and-platforms/server-types/forge.md) and [Fabric](../types-and-platforms/server-types/fabric.md). "Plugins" are used by the types that **only run on servers** to add behaviors, commands, etc such as [Paper](../types-and-platforms/server-types/paper.md) (which derives from [Bukkit/Spigot](../types-and-platforms/server-types/bukkit-spigot.md)). There are also some types that are [hybrids](../types-and-platforms/server-types/hybrids.md), such as Magma, that use both "mods" and "plugins".
Typically, mods needs to be installed in both the client and server; however, there are some cases when only the server needs a mod. Plugins only need to be installed in the server and are never needed in the client.
## Optional plugins, mods, and config attach points ## Optional plugins, mods, and config attach points
@@ -41,8 +43,28 @@ For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMO
These paths work well if you want to have a common set of modules in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive. These paths work well if you want to have a common set of modules in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive.
!!! information "" !!! information "Multiple source directories"
For more flexibility with mods/plugins preparation, you can declare other directories, files, and URLs to use in [the `MODS` / `PLUGINS` variables](#modsplugins-list).
`COPY_PLUGINS_SRC`, `COPY_MODS_SRC`, `COPY_CONFIG_SRC` can each be set to a comma or newline delimited list of container directories to reference.
For example, in a compose file:
```yaml
environment:
# ...EULA, etc
TYPE: PAPER
# matches up to volumes declared below
COPY_PLUGINS_SRC: /plugins-common,/plugins-local
volumes:
- mc-data:/data
# For example, reference a shared directory used by several projects
- ../plugins-common:/plugins-common:ro
# and add plugins unique to this project
- ./plugins:/plugins-local:ro
```
Alternatively, you can declare other directories along with files and URLs to use in [the `MODS` / `PLUGINS` variables](#modsplugins-list).
## Zip file modpack ## Zip file modpack

View File

@@ -1,16 +1,16 @@
services: services:
mc: mc:
image: itzg/minecraft-server image: itzg/minecraft-server
container_name: paper tty: true
stdin_open: true
environment: environment:
EULA: "true" EULA: "true"
TYPE: PAPER TYPE: PAPER
VIEW_DISTANCE: 10
MEMORY: 2G MEMORY: 2G
ports: ports:
- "25565:25565" - "25565:25565"
volumes: volumes:
- mc-paper:/data - mc-data:/data
restart: unless-stopped restart: unless-stopped
volumes: volumes:
mc-paper: {} mc-data: {}

View File

@@ -38,7 +38,7 @@ function mc-image-helper-mounts(){
: "${COPY_PLUGINS_SRC:="/plugins"}" : "${COPY_PLUGINS_SRC:="/plugins"}"
: "${COPY_PLUGINS_DEST:=${PLUGINS_OUT_DIR}}" : "${COPY_PLUGINS_DEST:=${PLUGINS_OUT_DIR}}"
if usesPlugins && [ -d "${COPY_PLUGINS_SRC}" ]; then if usesPlugins; then
mkdir -p "${COPY_PLUGINS_DEST}" mkdir -p "${COPY_PLUGINS_DEST}"
log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}" log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}"
mc-image-helper-mounts "${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}" mc-image-helper-mounts "${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}"
@@ -47,7 +47,7 @@ fi
: "${COPY_MODS_SRC:="/mods"}" : "${COPY_MODS_SRC:="/mods"}"
: "${COPY_MODS_DEST:=${MODS_OUT_DIR}}" : "${COPY_MODS_DEST:=${MODS_OUT_DIR}}"
if usesMods && [ -d "${COPY_MODS_SRC}" ]; then if usesMods; then
log "Copying any mods from ${COPY_MODS_SRC} to ${COPY_MODS_DEST}" log "Copying any mods from ${COPY_MODS_SRC} to ${COPY_MODS_DEST}"
mc-image-helper-mounts "${COPY_MODS_SRC}" "${COPY_MODS_DEST}" mc-image-helper-mounts "${COPY_MODS_SRC}" "${COPY_MODS_DEST}"
fi fi
@@ -55,9 +55,7 @@ fi
: "${COPY_CONFIG_SRC:="/config"}" : "${COPY_CONFIG_SRC:="/config"}"
: "${COPY_CONFIG_DEST:="/data/config"}" : "${COPY_CONFIG_DEST:="/data/config"}"
if [ -d "${COPY_CONFIG_SRC}" ]; then log "Copying any configs from ${COPY_CONFIG_SRC} to ${COPY_CONFIG_DEST}"
log "Copying any configs from ${COPY_CONFIG_SRC} to ${COPY_CONFIG_DEST}" mc-image-helper-mounts "${COPY_CONFIG_SRC}" "${COPY_CONFIG_DEST}"
mc-image-helper-mounts "${COPY_CONFIG_SRC}" "${COPY_CONFIG_DEST}"
fi
exec "${SCRIPTS:-/}start-setupServerProperties" "$@" exec "${SCRIPTS:-/}start-setupServerProperties" "$@"