mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-18 07:26:24 +00:00
Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8987d2cc81 | ||
|
|
45d5fd1a97 | ||
|
|
93c0cead40 | ||
|
|
195d35214b | ||
|
|
2de3efea15 | ||
|
|
0599fa64c2 | ||
|
|
94df6cca20 | ||
|
|
6fb34cd256 | ||
|
|
0d5e44a338 | ||
|
|
cffe4012aa | ||
|
|
909ea4e214 | ||
|
|
106996f06f | ||
|
|
d672b3878f | ||
|
|
0d71ace7df | ||
|
|
bee51671bf | ||
|
|
ab2f77d8ba | ||
|
|
f1aad07804 | ||
|
|
e7084c233e | ||
|
|
7f3c3b2d64 | ||
|
|
f6493892e5 | ||
|
|
0dd3e9e9b7 | ||
|
|
db3fbd8cd1 | ||
|
|
e01fe46645 | ||
|
|
f2b3f6ea48 | ||
|
|
8ae707954b | ||
|
|
08d8472579 | ||
|
|
0f359dbf82 | ||
|
|
e217ac503e | ||
|
|
e43669d792 | ||
|
|
cf4fed616a | ||
|
|
6d5b7b4362 | ||
|
|
9b538267a1 | ||
|
|
b7e93e56e5 | ||
|
|
3624dc02a3 | ||
|
|
705e266f76 | ||
|
|
a18a274c6c | ||
|
|
19c39f8e53 | ||
|
|
b40bd508f8 | ||
|
|
9dbc210caf | ||
|
|
2cdb7b2da7 | ||
|
|
4df1db9535 | ||
|
|
812b64045d | ||
|
|
f65d51fff8 | ||
|
|
fd2dfe3f0e | ||
|
|
d9b738f670 | ||
|
|
b8a7bf5a1d | ||
|
|
822bf929c9 | ||
|
|
b400dfbb74 | ||
|
|
1c670815d2 | ||
|
|
184d5b50d2 | ||
|
|
5624faebe7 | ||
|
|
104eac4e14 | ||
|
|
e0069692e0 | ||
|
|
03aaf45879 | ||
|
|
08b5303bd8 | ||
|
|
8efb486c56 | ||
|
|
2701fe5add | ||
|
|
906e6787ae | ||
|
|
a08bf868c8 | ||
|
|
b90f980d3b | ||
|
|
1e0d12869f | ||
|
|
1c73b818fd | ||
|
|
5bc6b4e12b | ||
|
|
7b1bd0bdb2 | ||
|
|
a701723cc1 | ||
|
|
2cde42b96e | ||
|
|
81571483e7 | ||
|
|
3f23c67098 | ||
|
|
b23593aec6 | ||
|
|
14cf300e82 | ||
|
|
f8ea9d49f5 | ||
|
|
c0be7dbb95 | ||
|
|
8017379723 | ||
|
|
df0c57d111 | ||
|
|
8d3ec29a44 | ||
|
|
c15b13d07d | ||
|
|
48367b7c1f | ||
|
|
dd6cda1ae5 | ||
|
|
877486802c | ||
|
|
7be36cc2cf |
6
.github/ISSUE_TEMPLATE/bug.yml
vendored
6
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -10,9 +10,9 @@ body:
|
||||
Thanks for taking the time to report a bug.
|
||||
|
||||
Please double check some things first:
|
||||
- Do you just have a question about something? If so, asking in the [Q&A Discussions](https://github.com/itzg/docker-minecraft-server/discussions/categories/q-a) or asking on [the Discord server](https://discord.gg/DXfKpjB) would be best.
|
||||
- Is this bug happening after the `[init]` prefixed logs and after the log that says "Starting the Minecraft server"? If so, please report the bug with Mojang or the respective server provider.
|
||||
- Are you seeing a performance problem? If so, that is typically outside the scope of the image setup mechanims. Ask a question as above or contact the respective server provider.
|
||||
1. Do you just have a question about something? If so, asking in the [Q&A Discussions](https://github.com/itzg/docker-minecraft-server/discussions/categories/q-a) or asking on [the Discord server](https://discord.gg/DXfKpjB) would be best.
|
||||
2. Is this bug happening after the `[init]` prefixed logs and after the log that says "Starting the Minecraft server"? If so, please report the bug with Mojang or the respective server provider.
|
||||
3. Are you seeing a performance problem? If so, that is typically outside the scope of the image setup mechanims. Ask a question as above or contact the respective server provider.
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
|
||||
16
.github/workflows/build-multiarch.yml
vendored
16
.github/workflows/build-multiarch.yml
vendored
@@ -16,7 +16,9 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# NOTE: the "latest" variant is identified in the Docker meta step's 'latest' config
|
||||
variant:
|
||||
- java19
|
||||
- java17
|
||||
- java17-graalvm-ce
|
||||
- java17-jdk
|
||||
@@ -31,6 +33,11 @@ jobs:
|
||||
- java11-openj9
|
||||
- java11-jdk
|
||||
include:
|
||||
# JAVA 19:
|
||||
- variant: java19
|
||||
baseImage: eclipse-temurin:19-jre-jammy
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
mcVersion: 1.19.3
|
||||
# JAVA 17:
|
||||
- variant: java17
|
||||
# jammy doesn't work until minecraft updates to https://github.com/netty/netty/issues/12343
|
||||
@@ -110,6 +117,8 @@ jobs:
|
||||
type=ref,event=tag,enable=${{ matrix.variant == 'java17' }}
|
||||
type=ref,event=tag,suffix=-${{ matrix.variant }}
|
||||
type=raw,value=${{ matrix.variant }}
|
||||
# NOTE this identifies which variant will be published as "latest", which isn't
|
||||
# necessarily the newest version of Java
|
||||
flavor: |
|
||||
latest=${{ matrix.variant == 'java17' }}
|
||||
labels: |
|
||||
@@ -122,7 +131,7 @@ jobs:
|
||||
uses: docker/setup-qemu-action@v2.1.0
|
||||
|
||||
- name: Build for test
|
||||
uses: docker/build-push-action@v3.2.0
|
||||
uses: docker/build-push-action@v3.3.0
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.IMAGE_TO_TEST }}
|
||||
@@ -152,7 +161,7 @@ jobs:
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3.2.0
|
||||
uses: docker/build-push-action@v3.3.0
|
||||
if: github.actor == github.repository_owner
|
||||
with:
|
||||
platforms: ${{ matrix.platforms }}
|
||||
@@ -169,6 +178,9 @@ jobs:
|
||||
# ensure latest base image is used
|
||||
pull: true
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
# Since some consumers, like Watchtower are broken https://github.com/containrrr/watchtower/discussions/1529
|
||||
# Also refer to https://github.com/docker/build-push-action/releases/tag/v3.3.0
|
||||
provenance: false
|
||||
build-args: |
|
||||
BASE_IMAGE=${{ matrix.baseImage }}
|
||||
BUILD_FILES_REV=${{ steps.build-files-rev.outputs.REV }}
|
||||
|
||||
2
.github/workflows/stale-check.yml
vendored
2
.github/workflows/stale-check.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Process Stale Issues
|
||||
uses: actions/stale@v7
|
||||
uses: actions/stale@v8
|
||||
with:
|
||||
stale-issue-label: status/stale
|
||||
stale-pr-label: status/stale
|
||||
|
||||
2
.github/workflows/verify-pr.yml
vendored
2
.github/workflows/verify-pr.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build for test
|
||||
uses: docker/build-push-action@v3.2.0
|
||||
uses: docker/build-push-action@v3.3.0
|
||||
with:
|
||||
platforms: linux/amd64
|
||||
tags: ${{ env.IMAGE_TO_TEST }}
|
||||
|
||||
34
Dockerfile
34
Dockerfile
@@ -3,25 +3,25 @@
|
||||
ARG BASE_IMAGE=eclipse-temurin:17-jre-focal
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# CI system should set this to a hash or git revision of the build directory and it's contents to
|
||||
# ensure consistent cache updates.
|
||||
ARG BUILD_FILES_REV=1
|
||||
RUN --mount=target=/build,source=build \
|
||||
REV=${BUILD_FILES_REV} /build/run.sh install-packages
|
||||
|
||||
RUN --mount=target=/build,source=build \
|
||||
REV=${BUILD_FILES_REV} /build/run.sh setup-user
|
||||
|
||||
COPY --chmod=644 files/sudoers* /etc/sudoers.d
|
||||
|
||||
EXPOSE 25565 25575
|
||||
|
||||
# hook into docker BuildKit --platform support
|
||||
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
||||
ARG TARGETOS
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
|
||||
# CI system should set this to a hash or git revision of the build directory and it's contents to
|
||||
# ensure consistent cache updates.
|
||||
ARG BUILD_FILES_REV=1
|
||||
RUN --mount=target=/build,source=build \
|
||||
REV=${BUILD_FILES_REV} TARGET=${TARGETARCH}${TARGETVARIANT} /build/run.sh install-packages
|
||||
|
||||
RUN --mount=target=/build,source=build \
|
||||
REV=${BUILD_FILES_REV} /build/run.sh setup-user
|
||||
|
||||
COPY --chmod=644 files/sudoers* /etc/sudoers.d
|
||||
|
||||
EXPOSE 25565
|
||||
|
||||
ARG EASY_ADD_VER=0.7.1
|
||||
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
|
||||
RUN chmod +x /usr/bin/easy-add
|
||||
@@ -31,7 +31,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--var version=1.6.0 --var app=rcon-cli --file {{.app}} \
|
||||
--var version=1.6.1 --var app=rcon-cli --file {{.app}} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
@@ -39,14 +39,14 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--var version=1.8.2 --var app=mc-server-runner --file {{.app}} \
|
||||
--var version=1.8.3 --var app=mc-server-runner --file {{.app}} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||
--var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \
|
||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||
|
||||
ARG MC_HELPER_VERSION=1.22.12
|
||||
ARG MC_HELPER_VERSION=1.26.2
|
||||
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
|
||||
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
|
||||
| tar -C /usr/share -zxf - \
|
||||
@@ -64,6 +64,8 @@ COPY --chmod=755 scripts/start* /
|
||||
COPY --chmod=755 bin/ /usr/local/bin/
|
||||
COPY --chmod=755 bin/mc-health /health.sh
|
||||
COPY --chmod=644 files/log4j2.xml /image/log4j2.xml
|
||||
# By default this file gets retrieved from repo, but bundle in image as potential fallback
|
||||
COPY --chmod=644 files/cf-exclude-include.json /image/cf-exclude-include.json
|
||||
COPY --chmod=755 files/auto /auto
|
||||
|
||||
RUN dos2unix /start* /auto/*
|
||||
|
||||
146
README.md
146
README.md
@@ -5,6 +5,14 @@
|
||||
[](https://github.com/itzg/docker-minecraft-server/actions)
|
||||
[](https://www.buymeacoffee.com/itzg)
|
||||
|
||||
---
|
||||
|
||||
## [View the documentation](https://itzg.github.io/docker-minecraft-docs/)
|
||||
|
||||
---
|
||||
|
||||
## Intro
|
||||
|
||||
This docker image provides a Minecraft Server that will automatically download the latest stable
|
||||
version at startup. You can also run/upgrade to any specific version or the
|
||||
latest snapshot. See the _Versions_ section below for more information.
|
||||
@@ -19,12 +27,10 @@ where, in this case, the standard server port 25565, will be exposed on your hos
|
||||
|
||||
> Be sure to always include `-e EULA=TRUE` in your commands and container definitions, as Mojang/Microsoft requires EULA acceptance.
|
||||
|
||||
> **DO NOT** port forward RCON on 25575 without first setting `RCON_PASSWORD` to a secure value. It is highly recommended to only use RCON within the container, such as with `rcon-cli`.
|
||||
|
||||
By default, the container will download the latest version of the "vanilla" [Minecraft: Java Edition server](https://www.minecraft.net/en-us/download/server) provided by Mojang. The [`VERSION`](#versions) and the [`TYPE`](#server-types) can be configured to create many variations of desired Minecraft server.
|
||||
|
||||
## Mitigated Log4jShell Vulnerability
|
||||
|
||||
**Please ensure you have pulled the latest image** since [all official mitigations](https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition) are automatically applied by the container startup process.
|
||||
|
||||
## Looking for a Bedrock Dedicated Server
|
||||
|
||||
For Minecraft clients running on consoles, mobile, or native Windows, you'll need to
|
||||
@@ -195,6 +201,7 @@ When using the image `itzg/minecraft-server` without a tag, the `latest` image t
|
||||
| java17-openj9 | 17 | Debian | OpenJ9 | amd64 |
|
||||
| java17-graalvm-ce | 17 | Oracle | GraalVM CE | amd64,arm64 |
|
||||
| java17-alpine | 17 | Alpine | Hotspot | amd64 |
|
||||
| java19 | 19 | Ubuntu | Hotspot | amd64,arm64,armv7 |
|
||||
|
||||
For example, to use Java version 8 on any supported architecture:
|
||||
|
||||
@@ -610,6 +617,108 @@ docker run -d --name mc-ftb -e EULA=TRUE \
|
||||
|
||||
## Running a server with a CurseForge modpack
|
||||
|
||||
### Auto CurseForge Management
|
||||
|
||||
To manage a CurseForge modpack automatically with upgrade support, pinned or latest version tracking, set `TYPE` to "AUTO_CURSEFORGE". The appropriate mod loader (Forge / Fabric) version will be automatically installed as declared by the modpack. This mode will also take care of cleaning up unused files installed by previous versions of the modpack, but world data is never auto-removed.
|
||||
|
||||
> **NOTES:**
|
||||
>
|
||||
> A CurseForge API key is **required** to use this feature. Go to their [developer console](https://console.curseforge.com/), generate an API key, and set the environment variable `CF_API_KEY`.
|
||||
>
|
||||
> When entering your API Key in a docker compose file you will need to escape any `$` character with a second `$`.
|
||||
>
|
||||
> Example if your key is `$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa`:
|
||||
> ```yaml
|
||||
> environment:
|
||||
> CF_API_KEY: '$$11$$22$$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
> ```
|
||||
> If you use `docker run` you will need to make sure to use single quotes:
|
||||
>
|
||||
> ```shell
|
||||
> docker run ... -e CF_API_KEY='$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
> ```
|
||||
>
|
||||
> To avoid exposing the API key, it is highly recommended to use a `.env` file, which is [loaded automatically by docker compose](https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file). `$`'s in the value still need to escaped with a second `$` and the variable needs to be referenced from the compose file, such as:
|
||||
> ```yaml
|
||||
> environment:
|
||||
> CF_API_KEY: ${CF_API_KEY}
|
||||
> ```
|
||||
>
|
||||
> To use the equivalent with `docker run` you need to specify the `.env` file explicitly:
|
||||
> ```
|
||||
> docker run --env-file=.env itzg/minecraft-server
|
||||
> ```
|
||||
>
|
||||
> Be sure to use the appropriate [image tag for the Java version compatible with the modpack](#running-minecraft-server-on-different-java-version).
|
||||
>
|
||||
> Most modpacks require a good amount of memory, so it best to set `MEMORY` to at least "4G" since the default is only 1 GB.
|
||||
|
||||
Use one of the following to specify the modpack to install:
|
||||
|
||||
Pass a page URL to the modpack or a specific file with `CF_PAGE_URL` such as the modpack page "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8" or a specific file "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390". For example:
|
||||
|
||||
```
|
||||
-e TYPE=AUTO_CURSEFORGE -e CF_PAGE_URL=https://www.curseforge.com/minecraft/modpacks/all-the-mods-8
|
||||
```
|
||||
|
||||
Instead of a URL, the modpack slug can be provided as `CF_SLUG`. The slug is the short identifier visible in the URL after "/modpacks/", such as
|
||||
|
||||

|
||||
|
||||
For example:
|
||||
```
|
||||
-e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8
|
||||
```
|
||||
|
||||
If the authors of the modpack have disallowed project distribution, then the desired **client** modpack zip will need to be manually downloaded and made available to the container. The path to that file must be passed to `CF_MODPACK_ZIP`.
|
||||
|
||||
The latest file will be located and used by default, but if a specific version is desired you can use one of the following options. With any of these options **do not select a server file** -- they lack the required manifest and defeat the ability to consistently automate startup.
|
||||
|
||||
- Use `CF_PAGE_URL`, but include the full URL to a specific file
|
||||
- Set `CF_FILE_ID` to the numerical file ID
|
||||
- Specify a substring to match the desired filename with `CF_FILENAME_MATCHER`
|
||||
|
||||
The following shows where to get the URL to the specific file and also shows where the file ID is located:
|
||||
|
||||

|
||||
|
||||
The following examples all refer to version 1.0.7 of ATM8:
|
||||
|
||||
```
|
||||
-e CF_PAGE_URL=https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390
|
||||
```
|
||||
|
||||
```
|
||||
-e CF_SLUG=all-the-mods-8 -e CF_FILE_ID=4248390
|
||||
```
|
||||
|
||||
```
|
||||
-e CF_SLUG=all-the-mods-8 -e CF_FILENAME_MATCHER=1.0.7
|
||||
```
|
||||
|
||||
Quite often there are mods that need to be excluded, such as ones that did not properly declare as a client mod via the file's game versions. Similarly, there are some mods that are incorrectly tagged as client only. The following describes two options to exclude/include mods:
|
||||
|
||||
Global and per modpack exclusions can be declared in a JSON file and referenced with `CF_EXCLUDE_INCLUDE_FILE`. By default, [the file bundled with the image](files/cf-exclude-include.json) will be used, but can be disabled by setting this to an empty string. The schema of this file [is documented here](https://github.com/itzg/mc-image-helper#excludeinclude-file-schema).
|
||||
|
||||
Alternatively, they can be excluded by passing a comma or space delimited list of **project** slugs or IDs via `CF_EXCLUDE_MODS`. Similarly, there are some mods that are incorrectly tagged as client only. For those, pass the **project** slugs or IDs via `CF_FORCE_INCLUDE_MODS`. These lists will be combined with the content of the exclude/include file, if given.
|
||||
|
||||
A mod's project ID can be obtained from the right hand side of the project page:
|
||||

|
||||
|
||||
If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true" to ensure the exclude/includes are re-evaluated.
|
||||
|
||||
> **NOTE:** these options are provided to empower you to get your server up and running quickly. Please help out by reporting an issue with the respective mod project. Ideally mod developers should [use correct registrations for one-sided client mods](https://docs.minecraftforge.net/en/latest/concepts/sides/#writing-one-sided-mods). Understandably, those code changes may be non-trivial, so mod authors can also add "Client" to the game versions when publishing.
|
||||
|
||||
Some modpacks come with world/save data via a worlds file and/or the overrides provided with the modpack. Either approach can be selected to set the `LEVEL` to the resulting saves directory by setting `CF_SET_LEVEL_FROM` to either:
|
||||
- `WORLD_FILE`
|
||||
- `OVERRIDES`
|
||||
|
||||
Other configuration available:
|
||||
- `CF_PARALLEL_DOWNLOADS` (default is 4): specify how many parallel mod downloads to perform
|
||||
- `CF_OVERRIDES_SKIP_EXISTING` (default is false): if set, files in the overrides that already exist in the data directory are skipped. **NOTE** world data is always skipped, if present.
|
||||
|
||||
### Old approach
|
||||
|
||||
Enable this server mode by adding `-e TYPE=CURSEFORGE` to your command-line,
|
||||
but note the following additional steps needed...
|
||||
|
||||
@@ -673,13 +782,13 @@ packwiz modpack defitions are processed before other mod definitions (`MODPACK`,
|
||||
There are optional volume paths that can be attached to supply content to be copied into the data area:
|
||||
|
||||
`/plugins`
|
||||
: contents are synchronized into `/data/plugins` for Bukkit related server types. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/plugins` to take precedence over newer files in `/data/plugins`.
|
||||
: contents are synchronized into `/data/plugins` for Bukkit related server types. The source can be changed by setting `COPY_PLUGINS_SRC`. The destination can be changed by setting `COPY_PLUGINS_DEST`. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/plugins` to take precedence over newer files in `/data/plugins`.
|
||||
|
||||
`/mods`
|
||||
: contents are synchronized into `/data/mods` for Fabric and Forge related server types. The destination can be changed by setting `COPY_MODS_DEST`.
|
||||
: contents are synchronized into `/data/mods` for Fabric and Forge related server types. The source can be changed by setting `COPY_MODS_SRC`. The destination can be changed by setting `COPY_MODS_DEST`.
|
||||
|
||||
`/config`
|
||||
: contents are synchronized into `/data/config` by default, but can be changed with `COPY_CONFIG_DEST`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/config` to take precedence over newer files in `/data/config`.
|
||||
: contents are synchronized into `/data/config` by default, but can be changed with `COPY_CONFIG_DEST`. The source can be changed by setting `COPY_CONFIG_SRC`. For example, `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over files like `bukkit.yml` and so on directly into the server directory. Set `SYNC_SKIP_NEWER_IN_DESTINATION=false` if you want files from `/config` to take precedence over newer files in `/data/config`.
|
||||
|
||||
By default, the [environment variable processing](#replacing-variables-inside-configs) is performed on synchronized files that match the expected suffixes in `REPLACE_ENV_SUFFIXES` (by default "yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml") and are not excluded by `REPLACE_ENV_VARIABLES_EXCLUDES` and `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. This processing can be disabled by setting `REPLACE_ENV_DURING_SYNC` to `false`.
|
||||
|
||||
@@ -719,6 +828,10 @@ For example, the following will auto-download the [EssentialsX](https://www.spig
|
||||
|
|
||||
+-- project slug
|
||||
```
|
||||
Also, specific version/type can be declared using colon symbol and version id/type after the project slug. The version id can be found at 'Metadata' section. Valid version types are `release`, `beta`, `alpha`. For instance:
|
||||
```
|
||||
-e MODRINTH_PROJECTS=fabric-api,fabric-api:PbVeub96,fabric-api:beta
|
||||
```
|
||||
- **MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES**=true : required dependencies of the project will _always_ be downloaded and optional dependencies can also be downloaded by setting this to `true`
|
||||
- **MODRINTH_ALLOWED_VERSION_TYPE**=release : the version type is used to determine the newest version to use from each project. The allowed values are `release`, `beta`, `alpha`.
|
||||
|
||||
@@ -1792,6 +1905,21 @@ The following environment variables define the behaviour of auto-pausing:
|
||||
|
||||
> To troubleshoot, add `DEBUG_AUTOPAUSE=true` to see additional output
|
||||
|
||||
### Rootless Autopause
|
||||
|
||||
If you're running the container as rootless, you might need to set change the default port forwarder from RootlessKit to slirp4netns.
|
||||
|
||||
For Docker, see the following for setup:
|
||||
* https://docs.docker.com/engine/security/rootless/#networking-errors
|
||||
* https://rootlesscontaine.rs/getting-started/docker/#changing-the-port-forwarder
|
||||
|
||||
For Podman, see the following for setup:
|
||||
* https://rootlesscontaine.rs/getting-started/podman/#changing-the-port-forwarder
|
||||
* Run with
|
||||
```
|
||||
-e AUTOPAUSE_KNOCK_INTERFACE=tap0 --cap-add=CAP_NET_RAW --network slirp4netns:port_handler=slirp4netns
|
||||
```
|
||||
|
||||
## Autostop
|
||||
|
||||
An option to stop the server after a specified time has been added for niche applications (e.g. billing saving on AWS Fargate). The function is incompatible with the Autopause functionality, as they basically cancel out each other.
|
||||
@@ -1824,6 +1952,10 @@ To run this image on a RaspberryPi 3 B+, 4, or newer, use any of the image tags
|
||||
|
||||
> If experiencing issues such as "sleep: cannot read realtime clock: Operation not permitted", ensure `libseccomp` is up to date on your host. In some cases adding `:Z` flag to the `/data` mount may be needed, [but use cautiously](https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label).
|
||||
|
||||
## Mitigated Log4jShell Vulnerability
|
||||
|
||||
**Please ensure you have pulled the latest image** since [all official mitigations](https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition) are automatically applied by the container startup process.
|
||||
|
||||
## Contributing
|
||||
|
||||
See [Development](DEVELOPMENT.md) and [Building](BUILDING.md).
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
apk add --no-cache -U \
|
||||
openssl \
|
||||
@@ -21,7 +22,12 @@ apk add --no-cache -U \
|
||||
rsync \
|
||||
nano \
|
||||
sudo \
|
||||
knock \
|
||||
tar \
|
||||
zstd \
|
||||
nfs-utils
|
||||
nfs-utils \
|
||||
libpcap
|
||||
|
||||
# Patched knockd
|
||||
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-alpine-amd64.tar.gz
|
||||
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
||||
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
export TARGET
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
microdnf install dnf -y
|
||||
|
||||
@@ -33,6 +35,11 @@ dnf install -y ImageMagick \
|
||||
unzip \
|
||||
zstd \
|
||||
lbzip2 \
|
||||
knock
|
||||
libpcap
|
||||
|
||||
bash /build/ol/install-gosu.sh
|
||||
|
||||
# Patched knockd
|
||||
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
|
||||
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
||||
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
export TARGET
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
apt-get update
|
||||
|
||||
@@ -23,7 +25,13 @@ apt-get install -y \
|
||||
unzip \
|
||||
zstd \
|
||||
lbzip2 \
|
||||
knockd \
|
||||
nfs-common
|
||||
nfs-common \
|
||||
libpcap0.8
|
||||
|
||||
apt-get clean
|
||||
apt-get clean
|
||||
|
||||
# Patched knockd
|
||||
curl -fsSL -o /tmp/knock.tar.gz https://github.com/Metalcape/knock/releases/download/0.8.1/knock-0.8.1-$TARGET.tar.gz
|
||||
tar -xf /tmp/knock.tar.gz -C /usr/local/ && rm /tmp/knock.tar.gz
|
||||
ln -s /usr/local/sbin/knockd /usr/sbin/knockd
|
||||
find /usr/lib -name 'libpcap.so.0.8' -execdir cp '{}' libpcap.so.1 \;
|
||||
|
||||
1
docs/.gitignore
vendored
Normal file
1
docs/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/.*.bkp
|
||||
BIN
docs/Going from docker run to compose.drawio.png
Normal file
BIN
docs/Going from docker run to compose.drawio.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 68 KiB |
BIN
docs/cf-file-id.png
Normal file
BIN
docs/cf-file-id.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
BIN
docs/cf-project-id.png
Normal file
BIN
docs/cf-project-id.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
BIN
docs/cf-slug.png
Normal file
BIN
docs/cf-slug.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 72 KiB |
2
examples/.gitignore
vendored
2
examples/.gitignore
vendored
@@ -1,2 +1,2 @@
|
||||
/data/
|
||||
data/
|
||||
modpacks/
|
||||
19
examples/atm8/docker-compose.yml
Normal file
19
examples/atm8/docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
ports:
|
||||
- "25565:25565"
|
||||
environment:
|
||||
EULA: "true"
|
||||
TYPE: AUTO_CURSEFORGE
|
||||
CF_API_KEY: # allocate from https://console.curseforge.com/
|
||||
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-8
|
||||
CF_FILENAME_MATCHER: "1.0.6"
|
||||
MEMORY: 4G
|
||||
volumes:
|
||||
- mc-data:/data
|
||||
|
||||
volumes:
|
||||
mc-data: {}
|
||||
@@ -5,15 +5,13 @@ services:
|
||||
container_name: paper
|
||||
environment:
|
||||
EULA: "true"
|
||||
ENABLE_RCON: "true"
|
||||
TYPE: PAPER
|
||||
VIEW_DISTANCE: 10
|
||||
MEMORY: 2G
|
||||
CONSOLE: "false"
|
||||
ports:
|
||||
- 25565:25565
|
||||
- "25565:25565"
|
||||
volumes:
|
||||
- mc-paper:/data
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
mc-paper:
|
||||
mc-paper: {}
|
||||
|
||||
@@ -6,7 +6,7 @@ services:
|
||||
tty: true
|
||||
stdin_open: true
|
||||
ports:
|
||||
- 25565:25565
|
||||
- "25565:25565"
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
volumes:
|
||||
|
||||
13
examples/modrinth-paper/docker-compose.yml
Normal file
13
examples/modrinth-paper/docker-compose.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||
environment:
|
||||
EULA: "true"
|
||||
TYPE: PAPER
|
||||
VERSION: 1.19.3
|
||||
MODRINTH_PROJECTS: "coreprotect"
|
||||
MODRINTH_ALLOWED_VERSION_TYPE: "release"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
1
examples/one-block-modded/.gitignore
vendored
Normal file
1
examples/one-block-modded/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/.env
|
||||
26
examples/one-block-modded/docker-compose.yml
Normal file
26
examples/one-block-modded/docker-compose.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
ports:
|
||||
- "25565:25565"
|
||||
environment:
|
||||
EULA: "true"
|
||||
TYPE: AUTO_CURSEFORGE
|
||||
# CF_API_KEY=... must be set in .env file or as environment variable
|
||||
CF_API_KEY: ${CF_API_KEY}
|
||||
CF_SLUG: one-block-modded
|
||||
# Modpack client zip must be manually downloaded from
|
||||
# https://www.curseforge.com/minecraft/modpacks/one-block-modded
|
||||
# due to authors disallowing project distribution
|
||||
CF_MODPACK_ZIP: /modpacks/Modded+OneBock.zip
|
||||
CF_SET_LEVEL_FROM: OVERRIDES
|
||||
DEBUG: "false"
|
||||
MEMORY: 4G
|
||||
volumes:
|
||||
- mc-data:/data
|
||||
- ./modpacks:/modpacks:ro
|
||||
|
||||
volumes:
|
||||
mc-data: {}
|
||||
19
examples/pixelmon/docker-compose.yml
Normal file
19
examples/pixelmon/docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server:java8-multiarch
|
||||
ports:
|
||||
- "25565:25565"
|
||||
environment:
|
||||
EULA: "true"
|
||||
TYPE: AUTO_CURSEFORGE
|
||||
CF_API_KEY: # allocate from https://console.curseforge.com/
|
||||
CF_SLUG: the-pixelmon-modpack
|
||||
CF_FILENAME_MATCHER: "9.1.2"
|
||||
MEMORY: 4G
|
||||
volumes:
|
||||
- mc-data:/data
|
||||
|
||||
volumes:
|
||||
mc-data: {}
|
||||
19
examples/valhesia5/docker-compose.yml
Normal file
19
examples/valhesia5/docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
ports:
|
||||
- "25565:25565"
|
||||
environment:
|
||||
EULA: "true"
|
||||
TYPE: AUTO_CURSEFORGE
|
||||
CF_API_KEY: # allocate from https://console.curseforge.com/
|
||||
CF_FORCE_SYNCHRONIZE: "true"
|
||||
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/valhelsia-5/files/4429560
|
||||
MEMORY: 4G
|
||||
volumes:
|
||||
- data:/data
|
||||
|
||||
volumes:
|
||||
data: {}
|
||||
@@ -25,3 +25,19 @@ services:
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
VANILLATWEAKS_SHARECODE: MGr52E
|
||||
REMOVE_OLD_VANILLATWEAKS: "TRUE"
|
||||
vanillatweaks_file_datapacks_and_resourcepacks_and_craftingtweaks:
|
||||
# port is set to 25567 to not conflict with vanillatweaks_file example
|
||||
restart: "no"
|
||||
image: itzg/minecraft-server
|
||||
ports:
|
||||
- "25567:25565/tcp"
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
VANILLATWEAKS_FILE: /config/vanillatweaks-datapacks.json,/config/vanillatweaks-resourcepacks.json,/config/vanillatweaks-craftingtweaks.json
|
||||
REMOVE_OLD_VANILLATWEAKS: "TRUE"
|
||||
volumes:
|
||||
- data:/data
|
||||
- ./vanillatweaks-datapacks.json:/config/vanillatweaks-datapacks.json:ro
|
||||
- ./vanillatweaks-resourcepacks.json:/config/vanillatweaks-resourcepacks.json:ro
|
||||
- ./vanillatweaks-craftingtweaks.json:/config/vanillatweaks-craftingtweaks.json:ro
|
||||
|
||||
12
examples/vanilla-tweaks/vanillatweaks-craftingtweaks.json
Normal file
12
examples/vanilla-tweaks/vanillatweaks-craftingtweaks.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "craftingtweaks",
|
||||
"version": "1.18",
|
||||
"packs": {
|
||||
"quality of life": [
|
||||
"dropper to dispenser",
|
||||
"double slabs",
|
||||
"back to blocks"
|
||||
]
|
||||
},
|
||||
"result": "ok"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"type": "datapacks",
|
||||
"version": "1.18",
|
||||
"packs": {
|
||||
"survival": [
|
||||
@@ -11,5 +12,6 @@
|
||||
"coordinates hud"
|
||||
],
|
||||
"items": ["armored elytra"]
|
||||
}
|
||||
},
|
||||
"result": "ok"
|
||||
}
|
||||
|
||||
8
examples/vanilla-tweaks/vanillatweaks-resourcepacks.json
Normal file
8
examples/vanilla-tweaks/vanillatweaks-resourcepacks.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"type": "resourcepacks",
|
||||
"version": "1.18",
|
||||
"packs": {
|
||||
"aesthetic": ["CherryPicking", "BlackNetherBricks", "AlternateBlockDestruction"]
|
||||
},
|
||||
"result": "ok"
|
||||
}
|
||||
19
examples/vault-hunters-1-18-2/docker-compose.yml
Normal file
19
examples/vault-hunters-1-18-2/docker-compose.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
ports:
|
||||
- "25565:25565"
|
||||
environment:
|
||||
EULA: "true"
|
||||
TYPE: AUTO_CURSEFORGE
|
||||
CF_API_KEY: # allocate from https://console.curseforge.com/
|
||||
CF_SLUG: vault-hunters-1-18-2
|
||||
CF_FILENAME_MATCHER: "Update-6H"
|
||||
MEMORY: 4G
|
||||
volumes:
|
||||
- mc-data:/data
|
||||
|
||||
volumes:
|
||||
mc-data: {}
|
||||
@@ -10,9 +10,7 @@ fi
|
||||
|
||||
autopause_error_loop() {
|
||||
logAutopause "Available interfaces within the docker container:"
|
||||
INTERFACES=$(echo /sys/class/net/*)
|
||||
INTERFACES=${INTERFACES//\/sys\/class\/net\//}
|
||||
logAutopause " $INTERFACES"
|
||||
logAutopause " $(mc-image-helper network-interfaces)"
|
||||
logAutopause "Please set the environment variable AUTOPAUSE_KNOCK_INTERFACE to the interface that handles incoming connections."
|
||||
logAutopause "If unsure which interface to choose, run the ifconfig command in the container."
|
||||
logAutopause "Autopause failed to initialize. This log entry will be printed every 30 minutes."
|
||||
@@ -37,7 +35,7 @@ if [[ -z "$AUTOPAUSE_KNOCK_INTERFACE" ]] ; then
|
||||
logAutopause "AUTOPAUSE_KNOCK_INTERFACE variable must not be empty!"
|
||||
autopause_error_loop
|
||||
fi
|
||||
if ! [[ -d "/sys/class/net/$AUTOPAUSE_KNOCK_INTERFACE" ]] ; then
|
||||
if ! mc-image-helper network-interfaces --check="$AUTOPAUSE_KNOCK_INTERFACE" ; then
|
||||
logAutopause "Selected interface \"$AUTOPAUSE_KNOCK_INTERFACE\" does not exist!"
|
||||
autopause_error_loop
|
||||
fi
|
||||
@@ -47,7 +45,7 @@ if isTrue "${DEBUG_AUTOPAUSE}"; then
|
||||
knockdArgs+=(-D)
|
||||
fi
|
||||
|
||||
sudo /usr/sbin/knockd "${knockdArgs[@]}"
|
||||
sudo /usr/local/sbin/knockd "${knockdArgs[@]}"
|
||||
if [ $? -ne 0 ] ; then
|
||||
logAutopause "Failed to start knockd daemon."
|
||||
logAutopause "Probable cause: Unable to attach to interface \"$AUTOPAUSE_KNOCK_INTERFACE\"."
|
||||
|
||||
@@ -23,7 +23,9 @@ mc_server_listening() {
|
||||
java_clients_connections() {
|
||||
local connections
|
||||
if java_running ; then
|
||||
connections=$(mc-monitor status --host localhost --port "$SERVER_PORT" --show-player-count)
|
||||
if ! connections=$(mc-monitor status --host localhost --port "$SERVER_PORT" --show-player-count); then
|
||||
connections=0
|
||||
fi
|
||||
else
|
||||
connections=0
|
||||
fi
|
||||
@@ -32,4 +34,4 @@ java_clients_connections() {
|
||||
|
||||
java_clients_connected() {
|
||||
(( $(java_clients_connections) > 0 ))
|
||||
}
|
||||
}
|
||||
@@ -13,3 +13,4 @@
|
||||
[unpauseMCServer-bedrock]
|
||||
sequence = 19132:udp
|
||||
command = /auto/resume.sh %IP%
|
||||
seq_cooldown = 60
|
||||
|
||||
34
files/cf-exclude-include.json
Normal file
34
files/cf-exclude-include.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"globalExcludes": [
|
||||
"carry-on",
|
||||
"defensive-measures",
|
||||
"dynamiclights-reforged",
|
||||
"entity-texture-features-fabric",
|
||||
"entityculling",
|
||||
"extreme-sound-muffler",
|
||||
"ignitioncoil",
|
||||
"legendary-tooltips",
|
||||
"neat",
|
||||
"nekos-enchanted-books",
|
||||
"not-enough-animations",
|
||||
"oculus",
|
||||
"rubidium",
|
||||
"rubidium-extra",
|
||||
"magnesium-extras",
|
||||
"skin-layers-3d",
|
||||
"textrues-rubidium-options",
|
||||
"torohealth-damage-indicators"
|
||||
],
|
||||
"modpacks": {
|
||||
"all-of-fabric-6": {
|
||||
"forceIncludes": [
|
||||
"revelationary"
|
||||
]
|
||||
},
|
||||
"valhelsia-5": {
|
||||
"excludes": [
|
||||
"modernfix"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
minecraft ALL=(ALL) NOPASSWD:/usr/bin/pkill
|
||||
minecraft ALL=(ALL) NOPASSWD:/usr/sbin/knockd
|
||||
minecraft ALL=(ALL) NOPASSWD:/usr/local/sbin/knockd
|
||||
|
||||
@@ -84,4 +84,9 @@ elif [[ -z "$MAX_TICK_TIME" ]] ; then
|
||||
export MAX_TICK_TIME
|
||||
fi
|
||||
|
||||
# seq_cooldown cannot be larger than AUTOPAUSE_TIMEOUT_KN, otherwise the server may
|
||||
# become paused while knockd is still ignoring packets, preventing players from joining.
|
||||
let COOLDOWN=$AUTOPAUSE_TIMEOUT_KN/2
|
||||
sed -i "s/\(seq_cooldown *= *\).*/\1$COOLDOWN/" /tmp/knockd-config.cfg
|
||||
|
||||
/auto/autopause-daemon.sh &
|
||||
|
||||
@@ -136,11 +136,11 @@ cd /data || exit 1
|
||||
export ORIGINAL_TYPE=${TYPE^^}
|
||||
|
||||
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
||||
${SCRIPTS:-/}start-autopause
|
||||
"${SCRIPTS:-/}start-autopause"
|
||||
fi
|
||||
|
||||
if isTrue "${ENABLE_AUTOSTOP}"; then
|
||||
${SCRIPTS:-/}start-autostop
|
||||
"${SCRIPTS:-/}start-autostop"
|
||||
fi
|
||||
|
||||
if
|
||||
@@ -152,7 +152,7 @@ if
|
||||
then
|
||||
log "Starting RCON commands"
|
||||
# shellcheck source=start-rconcmds
|
||||
${SCRIPTS:-/}start-rconcmds
|
||||
"${SCRIPTS:-/}start-rconcmds"
|
||||
fi
|
||||
|
||||
if versionLessThan 1.7; then
|
||||
@@ -196,6 +196,11 @@ case "${TYPE^^}" in
|
||||
exec "${SCRIPTS:-/}start-deployCF" "$@"
|
||||
;;
|
||||
|
||||
AUTO_CURSEFORGE)
|
||||
evaluateJavaCompatibilityForForge
|
||||
exec "${SCRIPTS:-/}start-deployAutoCF" "$@"
|
||||
;;
|
||||
|
||||
VANILLA)
|
||||
exec "${SCRIPTS:-/}start-deployVanilla" "$@"
|
||||
;;
|
||||
|
||||
69
scripts/start-deployAutoCF
Normal file
69
scripts/start-deployAutoCF
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
# shellcheck source=start-utils
|
||||
. "${SCRIPTS:-/}start-utils"
|
||||
|
||||
: "${CF_PAGE_URL:=}"
|
||||
: "${CF_SLUG:=}"
|
||||
: "${CF_FILE_ID:=}"
|
||||
: "${CF_FILENAME_MATCHER:=}"
|
||||
: "${CF_PARALLEL_DOWNLOADS:=4}"
|
||||
: "${CF_FORCE_SYNCHRONIZE:=false}"
|
||||
: "${CF_EXCLUDE_INCLUDE_FILE=https://raw.githubusercontent.com/itzg/docker-minecraft-server/master/files/cf-exclude-include.json}"
|
||||
: "${CF_EXCLUDE_MODS:=}"
|
||||
: "${CF_FORCE_INCLUDE_MODS:=}"
|
||||
: "${CF_SET_LEVEL_FROM:=}" # --set-level-from
|
||||
: "${CF_OVERRIDES_SKIP_EXISTING:=false}" # --overrides-skip-existing
|
||||
|
||||
|
||||
resultsFile=/data/.install-curseforge.env
|
||||
|
||||
isDebugging && set -x
|
||||
|
||||
args=(
|
||||
--results-file="$resultsFile"
|
||||
)
|
||||
if [[ $CF_PAGE_URL ]]; then
|
||||
args+=(--modpack-page-url="$CF_PAGE_URL")
|
||||
fi
|
||||
if [[ $CF_FILE_ID ]]; then
|
||||
args+=(--file-id="$CF_FILE_ID")
|
||||
fi
|
||||
if [[ $CF_SLUG ]]; then
|
||||
args+=(--slug="$CF_SLUG")
|
||||
fi
|
||||
if [[ $CF_FILENAME_MATCHER ]]; then
|
||||
args+=(--filename-matcher="$CF_FILENAME_MATCHER")
|
||||
fi
|
||||
if [[ ${CF_SET_LEVEL_FROM} ]]; then
|
||||
args+=(--set-level-from="$CF_SET_LEVEL_FROM")
|
||||
fi
|
||||
args+=(
|
||||
--parallel-downloads="$CF_PARALLEL_DOWNLOADS"
|
||||
--force-synchronize="$CF_FORCE_SYNCHRONIZE"
|
||||
--overrides-skip-existing="$CF_OVERRIDES_SKIP_EXISTING"
|
||||
)
|
||||
|
||||
if [[ $CF_EXCLUDE_MODS ]]; then
|
||||
args+=( --exclude-mods="$CF_EXCLUDE_MODS" )
|
||||
fi
|
||||
if [[ $CF_FORCE_INCLUDE_MODS ]]; then
|
||||
args+=( --force-include-mods="$CF_FORCE_INCLUDE_MODS" )
|
||||
fi
|
||||
if [[ $CF_EXCLUDE_INCLUDE_FILE ]]; then
|
||||
args+=( --exclude-include-file="$CF_EXCLUDE_INCLUDE_FILE" )
|
||||
fi
|
||||
|
||||
if ! mc-image-helper install-curseforge "${args[@]}"; then
|
||||
log "ERROR failed to auto-install CurseForge modpack"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# grab SERVER, FAMILY and export it
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
source "${resultsFile}"
|
||||
set +a
|
||||
|
||||
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||
@@ -4,47 +4,49 @@ set -eu
|
||||
# shellcheck source=start-utils
|
||||
. "${SCRIPTS:-/}start-utils"
|
||||
|
||||
requireVar VANILLA_VERSION
|
||||
export TYPE=FABRIC
|
||||
: "${FABRIC_LAUNCHER_VERSION:=${FABRIC_INSTALLER_VERSION:-LATEST}}"
|
||||
: "${FABRIC_LAUNCHER:=}"
|
||||
: "${FABRIC_LAUNCHER_URL:=}"
|
||||
: "${FABRIC_LOADER_VERSION:=LATEST}"
|
||||
|
||||
resultsFile=/data/.install-fabric.env
|
||||
|
||||
isDebugging && set -x
|
||||
|
||||
# Custom fabric jar
|
||||
if [[ $FABRIC_LAUNCHER ]]; then
|
||||
export SERVER=${FABRIC_LAUNCHER}
|
||||
if ! mc-image-helper install-fabric-loader \
|
||||
--results-file=${resultsFile} \
|
||||
--from-local-file="$FABRIC_LAUNCHER"; then
|
||||
log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER"
|
||||
exit 1
|
||||
fi
|
||||
# Custom fabric jar url
|
||||
elif [[ $FABRIC_LAUNCHER_URL ]]; then
|
||||
export SERVER=fabric-server-$(echo -n "$FABRIC_LAUNCHER_URL" | mc-image-helper hash)
|
||||
if ! mc-image-helper install-fabric-loader \
|
||||
--results-file=${resultsFile} \
|
||||
--from-url="$FABRIC_LAUNCHER_URL"; then
|
||||
log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER_URL"
|
||||
exit 1
|
||||
fi
|
||||
# Official fabric launcher
|
||||
else
|
||||
if [[ ${FABRIC_LAUNCHER_VERSION^^} = LATEST ]]; then
|
||||
log "Checking Fabric Launcher version information."
|
||||
FABRIC_LAUNCHER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
|
||||
fi
|
||||
if [[ ${FABRIC_LOADER_VERSION^^} = LATEST ]]; then
|
||||
log "Checking Fabric Loader version information."
|
||||
FABRIC_LOADER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml)
|
||||
fi
|
||||
export SERVER=fabric-server-mc.${VANILLA_VERSION}-loader.${FABRIC_LOADER_VERSION}-launcher.${FABRIC_LAUNCHER_VERSION}.jar
|
||||
export FABRIC_LAUNCHER_URL="https://meta.fabricmc.net/v2/versions/loader/${VANILLA_VERSION}/${FABRIC_LOADER_VERSION}/${FABRIC_LAUNCHER_VERSION}/server/jar"
|
||||
fi
|
||||
|
||||
if [[ ! -e ${SERVER} && ! -z ${FABRIC_LAUNCHER_URL} ]]; then
|
||||
log "Downloading $FABRIC_LAUNCHER_URL ..."
|
||||
if ! get -o "$SERVER" "$FABRIC_LAUNCHER_URL"; then
|
||||
log "Failed to download from given location $FABRIC_LAUNCHER_URL"
|
||||
exit 2
|
||||
if ! mc-image-helper install-fabric-loader \
|
||||
--results-file=${resultsFile} \
|
||||
--minecraft-version="${VANILLA_VERSION}" \
|
||||
--installer-version="${FABRIC_LAUNCHER_VERSION}" \
|
||||
--loader-version="${FABRIC_LOADER_VERSION}"; then
|
||||
log "ERROR failed to install Fabric launcher from $VANILLA_VERSION, $FABRIC_LAUNCHER_VERSION, $FABRIC_LOADER_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -e ${SERVER} ]]; then
|
||||
log "$SERVER does not exist, cannot launch server!"
|
||||
exit 1
|
||||
fi
|
||||
# grab SERVER and export it
|
||||
set -a
|
||||
# shellcheck disable=SC1090
|
||||
source "${resultsFile}"
|
||||
set +a
|
||||
|
||||
export FAMILY=FABRIC
|
||||
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||
|
||||
@@ -7,16 +7,33 @@
|
||||
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
|
||||
isDebugging && set -x
|
||||
|
||||
if ! mc-image-helper install-forge \
|
||||
--output-directory=/data \
|
||||
--results-file=/data/.run-forge.env \
|
||||
--minecraft-version="${VANILLA_VERSION}" \
|
||||
--forge-version="${FORGE_VERSION}" \
|
||||
--force-reinstall="${FORGE_FORCE_REINSTALL}"; then
|
||||
log "ERROR failed to install forge"
|
||||
exit 1
|
||||
# NOTE: VERSION rather than VANILLA_VERSION is specified to allow for latest supported
|
||||
# Forge version to be selected.
|
||||
if [[ ${FORGE_INSTALLER} ]]; then
|
||||
if ! mc-image-helper install-forge \
|
||||
--output-directory=/data \
|
||||
--results-file=/data/.run-forge.env \
|
||||
--minecraft-version="${VERSION}" \
|
||||
--forge-installer="${FORGE_INSTALLER}" \
|
||||
--force-reinstall="${FORGE_FORCE_REINSTALL}"; then
|
||||
log "ERROR failed to install Forge given installer ${FORGE_INSTALLER}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
if ! mc-image-helper install-forge \
|
||||
--output-directory=/data \
|
||||
--results-file=/data/.run-forge.env \
|
||||
--minecraft-version="${VERSION}" \
|
||||
--forge-version="${FORGE_VERSION}" \
|
||||
--force-reinstall="${FORGE_FORCE_REINSTALL}"; then
|
||||
log "ERROR failed to install Forge"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# grab SERVER and export it
|
||||
set -a
|
||||
source /data/.run-forge.env
|
||||
|
||||
@@ -183,7 +183,7 @@ esac
|
||||
fi
|
||||
}
|
||||
|
||||
function genericPacks() {
|
||||
function handleGenericPacks() {
|
||||
: "${GENERIC_PACKS:=${GENERIC_PACK}}"
|
||||
: "${GENERIC_PACKS_PREFIX:=}"
|
||||
: "${GENERIC_PACKS_SUFFIX:=}"
|
||||
@@ -267,16 +267,19 @@ function genericPacks() {
|
||||
fi
|
||||
}
|
||||
|
||||
function modrinthProjects() {
|
||||
function handleModrinthProjects() {
|
||||
: "${MODRINTH_PROJECTS:=}"
|
||||
: "${MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES:=true}"
|
||||
: "${MODRINTH_ALLOWED_VERSION_TYPE:=release}"
|
||||
|
||||
if [[ $MODRINTH_PROJECTS ]] && isFamily HYBRID FORGE FABRIC; then
|
||||
if [[ $MODRINTH_PROJECTS ]] && isFamily HYBRID FORGE FABRIC SPIGOT; then
|
||||
if isFamily HYBRID FORGE; then
|
||||
loader=forge
|
||||
elif isFamily FABRIC; then
|
||||
loader=fabric
|
||||
else
|
||||
loader="${FAMILY,,}"
|
||||
# we're left with Bukkit/Spigot down-lines where plugins seem to be
|
||||
loader="${TYPE,,}"
|
||||
fi
|
||||
mc-image-helper modrinth \
|
||||
--output-directory=/data \
|
||||
@@ -294,8 +297,8 @@ handleModpackListOrFile
|
||||
|
||||
handleCurseForgeManifest
|
||||
|
||||
genericPacks
|
||||
handleGenericPacks
|
||||
|
||||
modrinthProjects
|
||||
handleModrinthProjects
|
||||
|
||||
exec "${SCRIPTS:-/}start-setupModconfig" "$@"
|
||||
|
||||
@@ -14,57 +14,62 @@
|
||||
set -e
|
||||
isDebugging && set -x
|
||||
|
||||
if isTrue ${SYNC_SKIP_NEWER_IN_DESTINATION}; then
|
||||
if isTrue "${SYNC_SKIP_NEWER_IN_DESTINATION}"; then
|
||||
updateArg="--skip-newer-in-destination"
|
||||
fi
|
||||
|
||||
if isTrue ${REPLACE_ENV_DURING_SYNC}; then
|
||||
if isTrue "${REPLACE_ENV_DURING_SYNC}"; then
|
||||
subcommand=sync-and-interpolate
|
||||
else
|
||||
subcommand=sync
|
||||
fi
|
||||
|
||||
if [ -d /plugins ]; then
|
||||
: "${COPY_PLUGINS_SRC:="/plugins"}"
|
||||
: "${COPY_PLUGINS_DEST:="/data/plugins"}"
|
||||
|
||||
if [ -d "${COPY_PLUGINS_SRC}" ]; then
|
||||
case ${FAMILY} in
|
||||
SPIGOT|HYBRID)
|
||||
mkdir -p /data/plugins
|
||||
log "Copying plugins over..."
|
||||
mkdir -p "${COPY_PLUGINS_DEST}"
|
||||
log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}"
|
||||
mc-image-helper \
|
||||
${subcommand} $updateArg \
|
||||
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
||||
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
||||
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
||||
--replace-env-prefix=${REPLACE_ENV_VARIABLE_PREFIX} \
|
||||
/plugins /data/plugins
|
||||
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
||||
"${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# If any modules have been provided, copy them over
|
||||
: "${COPY_MODS_SRC:="/mods"}"
|
||||
: "${COPY_MODS_DEST:="/data/mods"}"
|
||||
|
||||
if [ -d /mods ]; then
|
||||
log "Copying any mods over..."
|
||||
if [ -d "${COPY_MODS_SRC}" ]; then
|
||||
log "Copying any mods from ${COPY_MODS_SRC} to ${COPY_MODS_DEST}"
|
||||
mc-image-helper \
|
||||
${subcommand} $updateArg \
|
||||
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
||||
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
||||
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
||||
--replace-env-prefix=${REPLACE_ENV_VARIABLE_PREFIX} \
|
||||
/mods "${COPY_MODS_DEST}"
|
||||
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
||||
"${COPY_MODS_SRC}" "${COPY_MODS_DEST}"
|
||||
fi
|
||||
|
||||
: "${COPY_CONFIG_SRC:="/config"}"
|
||||
: "${COPY_CONFIG_DEST:="/data/config"}"
|
||||
|
||||
if [ -d /config ]; then
|
||||
log "Copying any configs from /config to ${COPY_CONFIG_DEST}"
|
||||
if [ -d "${COPY_CONFIG_SRC}" ]; then
|
||||
log "Copying any configs from ${COPY_CONFIG_SRC} to ${COPY_CONFIG_DEST}"
|
||||
mc-image-helper \
|
||||
${subcommand} $updateArg \
|
||||
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
||||
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
||||
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
||||
--replace-env-prefix=${REPLACE_ENV_VARIABLE_PREFIX} \
|
||||
/config "${COPY_CONFIG_DEST}"
|
||||
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
||||
"${COPY_CONFIG_SRC}" "${COPY_CONFIG_DEST}"
|
||||
fi
|
||||
|
||||
exec "${SCRIPTS:-/}start-setupServerProperties" "$@"
|
||||
|
||||
17
tests/setuponlytests/auto_curseforge/docker-compose.yml
Normal file
17
tests/setuponlytests/auto_curseforge/docker-compose.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||
environment:
|
||||
EULA: "true"
|
||||
SETUP_ONLY: "TRUE"
|
||||
TYPE: AUTO_CURSEFORGE
|
||||
CF_API_KEY: ${CF_API_KEY}
|
||||
CF_SLUG: the-pixelmon-modpack
|
||||
CF_FILENAME_MATCHER: "9.1.2"
|
||||
# Use the image bundled one to ensure latest is being tested
|
||||
CF_EXCLUDE_INCLUDE_FILE: /image/cf-exclude-include.json
|
||||
volumes:
|
||||
- ./data:/data
|
||||
|
||||
1
tests/setuponlytests/auto_curseforge/require.sh
Executable file
1
tests/setuponlytests/auto_curseforge/require.sh
Executable file
@@ -0,0 +1 @@
|
||||
[[ $CF_API_KEY ]] || exit 1
|
||||
2
tests/setuponlytests/auto_curseforge/verify.sh
Normal file
2
tests/setuponlytests/auto_curseforge/verify.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
mc-image-helper assert fileExists "/data/mods/ExplorersCompass-1.16.5-1.1.2-forge.jar"
|
||||
mc-image-helper assert fileExists "/data/forge-1.16.5-36.2.34.jar"
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
21
tests/setuponlytests/mounts-custom/docker-compose.yml
Normal file
21
tests/setuponlytests/mounts-custom/docker-compose.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
|
||||
environment:
|
||||
EULA: "true"
|
||||
SETUP_ONLY: "true"
|
||||
TYPE: CUSTOM
|
||||
CUSTOM_SERVER: /servers/fake.jar
|
||||
VERSION: 1.18.1
|
||||
COPY_PLUGINS_SRC: /custom/plugins
|
||||
COPY_PLUGINS_DEST: /data/custom-plugins
|
||||
COPY_MODS_SRC: /custom/mods
|
||||
COPY_MODS_DEST: /data/custom-mods
|
||||
COPY_CONFIG_SRC: /custom/config
|
||||
COPY_CONFIG_DEST: /data/custom-config
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- ./custom:/custom
|
||||
- ./fake.jar:/servers/fake.jar
|
||||
0
tests/setuponlytests/mounts-custom/fake.jar
Normal file
0
tests/setuponlytests/mounts-custom/fake.jar
Normal file
3
tests/setuponlytests/mounts-custom/verify.sh
Normal file
3
tests/setuponlytests/mounts-custom/verify.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
mc-image-helper assert fileExists custom-plugins/plugin.jar
|
||||
mc-image-helper assert fileExists custom-mods/mod.jar
|
||||
mc-image-helper assert fileExists custom-config/test.json
|
||||
2
tests/setuponlytests/packwiz/require.sh
Executable file
2
tests/setuponlytests/packwiz/require.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
# maven.packwiz.infra.link is not resolvable
|
||||
exit 1
|
||||
Reference in New Issue
Block a user