Compare commits

..

1 Commits

Author SHA1 Message Date
Geoff Bourne fbb2a0d8d7 Build native mc-image-helper 2023-10-18 20:30:18 -05:00
12 changed files with 62 additions and 144 deletions
-1
View File
@@ -21,4 +21,3 @@ updates:
- "*" - "*"
update-types: update-types:
- patch - patch
- minor
+8 -7
View File
@@ -19,8 +19,8 @@ jobs:
# NOTE: the "latest" variant is identified in the Docker meta step's 'latest' config # NOTE: the "latest" variant is identified in the Docker meta step's 'latest' config
variant: variant:
- java21-graalvm - java21-graalvm
- java21 - java20
- java21-alpine - java20-alpine
- java17 - java17
- java17-graalvm - java17-graalvm
- java17-jdk - java17-jdk
@@ -40,12 +40,13 @@ jobs:
baseImage: container-registry.oracle.com/graalvm/jdk:21-ol8 baseImage: container-registry.oracle.com/graalvm/jdk:21-ol8
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
mcVersion: 1.20.2 mcVersion: 1.20.2
- variant: java21 # JAVA 20:
baseImage: eclipse-temurin:21-jre - variant: java20
baseImage: eclipse-temurin:20-jre
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
mcVersion: 1.19.3 mcVersion: 1.19.3
- variant: java21-alpine - variant: java20-alpine
baseImage: eclipse-temurin:21-jre-alpine baseImage: eclipse-temurin:20-jre-alpine
platforms: linux/amd64 platforms: linux/amd64
mcVersion: 1.19.3 mcVersion: 1.19.3
# JAVA 17: # JAVA 17:
@@ -111,7 +112,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.0
with: with:
# for build-files step # for build-files step
fetch-depth: 0 fetch-depth: 0
+5 -5
View File
@@ -16,14 +16,14 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
variant: variant:
- java21 - java20
- java17 - java17
- java17-alpine - java17-alpine
- java8-multiarch - java8-multiarch
include: include:
# JAVA 21: # JAVA 20:
- variant: java21 - variant: java20
baseImage: eclipse-temurin:21-jre baseImage: eclipse-temurin:20-jre
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
mcVersion: 1.19.4 mcVersion: 1.19.4
# JAVA 17: # JAVA 17:
@@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.0
with: with:
# for build-files step # for build-files step
fetch-depth: 0 fetch-depth: 0
+21 -14
View File
@@ -1,6 +1,19 @@
# syntax = docker/dockerfile:1.3 # syntax = docker/dockerfile:1.5-labs
ARG BASE_IMAGE=eclipse-temurin:17-jre-focal ARG BASE_IMAGE=eclipse-temurin:17-jre-focal
###############################################################################
FROM container-registry.oracle.com/graalvm/native-image:21-ol8 AS helper-native-builder
# findutils provides xargs, needed by gradle wrapper
RUN microdnf install findutils
ADD https://github.com/itzg/mc-image-helper.git#feat/graalvm /helper
WORKDIR /helper
RUN ./gradlew nativeCompile
###############################################################################
FROM ${BASE_IMAGE} FROM ${BASE_IMAGE}
# hook into docker BuildKit --platform support # hook into docker BuildKit --platform support
@@ -22,33 +35,27 @@ COPY --chmod=644 files/sudoers* /etc/sudoers.d
EXPOSE 25565 EXPOSE 25565
ARG EASY_ADD_VER=0.8.1 ARG EASY_ADD_VER=0.8.0
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add 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 RUN chmod +x /usr/bin/easy-add
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=1.7.1 --var app=restify --file {{.app}} \ --var version=1.7.0 --var app=restify --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --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} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=1.6.3 --var app=rcon-cli --file {{.app}} \ --var version=1.6.2 --var app=rcon-cli --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --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} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=0.12.5 --var app=mc-monitor --file {{.app}} \ --var version=0.12.3 --var app=mc-monitor --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --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} \ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=1.9.1 --var app=mc-server-runner --file {{.app}} \ --var version=1.9.0 --var app=mc-server-runner --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_HELPER_VERSION=1.36.5 COPY --from=helper-native-builder /helper/build/native/nativeCompile/mc-image-helper /usr/bin/
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
| tar -C /usr/share -zxf - \
&& ln -s /usr/share/mc-image-helper-${MC_HELPER_VERSION}/bin/mc-image-helper /usr/bin
VOLUME ["/data"] VOLUME ["/data"]
WORKDIR /data WORKDIR /data
+1 -39
View File
@@ -40,8 +40,6 @@ Valid values are: `peaceful`, `easy`, `normal`, and `hard`, and an
error message will be output in the logs if it's not one of these error message will be output in the logs if it's not one of these
values. values.
Refer to [the Minecraft wiki](https://minecraft.wiki/w/Difficulty)
### Whitelist Players ### Whitelist Players
!!! warning "For public servers" !!! warning "For public servers"
@@ -305,43 +303,7 @@ environment variable set to `false`, such as
By default, a standard world is generated with hills, valleys, water, etc. A different level type can By default, a standard world is generated with hills, valleys, water, etc. A different level type can
be configured by setting `LEVEL_TYPE` to [an expected type listed here](https://minecraft.wiki/w/Server.properties#level-type). be configured by setting `LEVEL_TYPE` to [an expected type listed here](https://minecraft.wiki/w/Server.properties#level-type).
For some of the level types, `GENERATOR_SETTINGS` can be used to further customize the world generation. For some of the level types, `GENERATOR_SETTINGS` can be used to further customize the world generation [as described here](https://minecraft.wiki/w/Server.properties#generator-settings).
To configure the `GENERATOR_SEETINGS` you need to add the appropriate `GeneratorOptions` JSON configuration. In the case of a superflat world, you may omit the `flat_world_options`.
The layers are applied from -64 and up and are added in the order of the list
Example for a superflat world:
- 1x bedrock
- 2x stone
- 15x sandstone
- Desert biome
```yaml
LEVEL_TYPE: FLAT
GENERATOR_SETTINGS: >-4
{
"layers": [
{
"block": "minecraft:bedrock",
"height": 1
},
{
"block": "minecraft:stone",
"height": 2
},
{
"block": "minecraft:sandstone",
"height": 15
}
],
"biome": "minecraft:desert"
}
```
For more details, check the [official wiki](https://minecraft.wiki/w/Java_Edition_level_format#generatorOptions_tag_format).
### Custom Server Resource Pack ### Custom Server Resource Pack
+1 -1
View File
@@ -83,7 +83,7 @@ cd build/distributions
jwebserver -b 0.0.0.0 -p 8008 jwebserver -b 0.0.0.0 -p 8008
``` ```
If `jwebserver` is not available, try `java -m jdk.httpserver -p 8008` If `jwebserver` is not available, try `java -m jdk.httpserver`
```shell ```shell
--build-arg MC_HELPER_VERSION=1.8.1-SNAPSHOT \ --build-arg MC_HELPER_VERSION=1.8.1-SNAPSHOT \
+5 -11
View File
@@ -1,22 +1,12 @@
# More Deployment Info # More Deployment Info
## On Kubernetes ## Using Helm
### Using Helm
- itzg Helm Chart: - itzg Helm Chart:
- [GitHub repo](https://github.com/itzg/minecraft-server-charts) - [GitHub repo](https://github.com/itzg/minecraft-server-charts)
- [Helm Chart repo](https://itzg.github.io/minecraft-server-charts/) - [Helm Chart repo](https://itzg.github.io/minecraft-server-charts/)
- [mcsh/server-deployment](https://github.com/mcserverhosting-net/charts) - [mcsh/server-deployment](https://github.com/mcserverhosting-net/charts)
### Using Shulker
[Shulker](https://github.com/jeremylvln/Shulker) is a Kubernetes operator for managing complex and dynamic Minecraft infrastructures, including game servers and proxies. It uses the docker-minecraft-server and docker-bungeecord images under-the-hood.
## On CloudFormation (AWS)
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.
## Supporting Articles ## Supporting Articles
Below are supporting articles for server deployment. Below are supporting articles for server deployment.
@@ -26,3 +16,7 @@ Below are supporting articles for server deployment.
https://dev.to/rela-v/zero-to-minecraft-server-with-docker-desktop-and-compose-500a https://dev.to/rela-v/zero-to-minecraft-server-with-docker-desktop-and-compose-500a
- This is a reference guide/tutorial on how to set up a vanilla Minecraft server using this project, including step-by-step instructions, and information on topics such as port-forwarding. - This is a reference guide/tutorial on how to set up a vanilla Minecraft server using this project, including step-by-step instructions, and information on topics such as port-forwarding.
## Deploying onto AWS
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.
+3 -3
View File
@@ -1,9 +1,9 @@
mkdocs == 1.5.3 mkdocs == 1.5.3
mkdocs-material-extensions == 1.3 mkdocs-material-extensions == 1.2
mkdocs-material == 9.4.8 mkdocs-material == 9.4.6
mkdocs-autorefs == 0.5.0 mkdocs-autorefs == 0.5.0
mkdocstrings == 0.23.0 mkdocstrings == 0.23.0
mkdocs-literate-nav == 0.6.1 mkdocs-literate-nav == 0.6.1
mdx-gh-links == 0.3.1 mdx-gh-links == 0.3.1
mkdocs-click == 0.8.1 mkdocs-click == 0.8.1
mkdocs-static-i18n == 1.2.0 mkdocs-static-i18n == 1.1.1
@@ -56,6 +56,13 @@ For example:
-e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8 -e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8
``` ```
For mod, modpacks, and world files that are not allowed for automated download, the container path `/downloads` can be attached and matching files will be retrieved from there. The subdirectories `mods`, `modpacks`, and `worlds` will also be checked accordingly. To change the source location of downloaded files, set `CF_DOWNLOADS_REPO` to an existing container path. To disable this feature, set `CF_DOWNLOADS_REPO` to an empty string.
!!! note "Mods need download report"
A file called `MODS_NEED_DOWNLOAD.txt` will be created in the `/data` directory that lists the mods that need to be manually downloaded and where to get them.
If you wish to use a unpublished modpack zip, set the container path to the file in `CF_MODPACK_ZIP`. Similarly, the container path to a modpack manifest JSON can be passed to `CF_MODPACK_MANIFEST`. In either case, **the modpack slug or page URL must still be provided**.
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. 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 - Use `CF_PAGE_URL`, but include the full URL to a specific file
@@ -68,30 +75,17 @@ The following shows where to get the URL to the specific file and also shows whe
The following examples all refer to version 1.0.7 of ATM8: The following examples all refer to version 1.0.7 of ATM8:
```yaml ```
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390 -e CF_PAGE_URL=https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390
``` ```
```yaml ```
CF_SLUG: all-the-mods-8 -e CF_SLUG=all-the-mods-8 -e CF_FILE_ID=4248390
CF_FILE_ID: "4248390"
``` ```
```yaml
CF_SLUG: all-the-mods-8
CF_FILENAME_MATCHER: 1.0.7
``` ```
-e CF_SLUG=all-the-mods-8 -e CF_FILENAME_MATCHER=1.0.7
## Manual Downloads ```
For mod, modpacks, and world files that are not allowed for automated download, the container path `/downloads` can be attached and matching files will be retrieved from there. The subdirectories `mods`, `modpacks`, and `worlds` will also be checked accordingly. To change the source location of downloaded files, set `CF_DOWNLOADS_REPO` to an existing container path. To disable this feature, set `CF_DOWNLOADS_REPO` to an empty string.
!!! note "Mods need download report"
A file called `MODS_NEED_DOWNLOAD.txt` will be created in the `/data` directory that lists the mods that need to be manually downloaded and where to get them.
## Unpublished Modpacks
If you wish to use a unpublished modpack zip, set the container path to the file in `CF_MODPACK_ZIP`. Similarly, the container path to a modpack manifest JSON can be passed to `CF_MODPACK_MANIFEST`. In either case, **the modpack slug or page URL must still be provided**.
## Exclude client mods ## Exclude client mods
@@ -109,44 +103,12 @@ If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true"
!!! important !!! important
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. 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.
## Excluding Overrides Files ## Extra options
Modpack zip files typically include an `overrides` subdirectory that may contain 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 `CF_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.
### Ant-style paths
Ant-style paths can include the following globbing/wildcard symbols:
| Symbol | Behavior |
|--------|---------------------------------------------------------|
| `*` | Matches zero, one, or many characters except a slash |
| `**` | Matches zero, one, or many characters including slashes |
| `?` | Matches one character |
!!! example
The following compose `environment` entries show how to exclude Iris and Sodium mods from the overrides
```yaml
CF_OVERRIDES_EXCLUSIONS: mods/iris*.jar,mods/sodium*.jar
```
or using newline delimiter, which improves maintainability
```yaml
CF_OVERRIDES_EXCLUSIONS: |
mods/iris*.jar
mods/sodium*.jar
```
## World/Level Data
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: 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` - `WORLD_FILE`
- `OVERRIDES` - `OVERRIDES`
## Extra options
Other configuration available: Other configuration available:
- `CF_PARALLEL_DOWNLOADS` (default is 4): specify how many parallel mod downloads to perform - `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. - `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.
+3 -3
View File
@@ -30,8 +30,8 @@ When using the image `itzg/minecraft-server` without a tag, the `latest` image t
| java17-openj9 | 17 | Debian | OpenJ9 | amd64 | | java17-openj9 | 17 | Debian | OpenJ9 | amd64 |
| java17-graalvm | 17 | Oracle | Oracle GraalVM | amd64,arm64 | | java17-graalvm | 17 | Oracle | Oracle GraalVM | amd64,arm64 |
| java17-alpine | 17 | Alpine | Hotspot | amd64 | | java17-alpine | 17 | Alpine | Hotspot | amd64 |
| java21-alpine | 21 | Alpine | Hotspot | amd64 | | java20-alpine | 20 | Alpine | Hotspot | amd64 |
| java21 | 21 | Ubuntu | Hotspot | amd64,arm64 | | java20 | 20 | Ubuntu | Hotspot | amd64,arm64 |
| java21-graalvm | 21 | Oracle | Oracle GraalVM | amd64,arm64 | | java21-graalvm | 21 | Oracle | Oracle GraalVM | amd64,arm64 |
For example, to use Java version 8 on any supported architecture: For example, to use Java version 8 on any supported architecture:
@@ -55,4 +55,4 @@ The following image tags have been deprecated and are no longer receiving update
- multiarch-latest - multiarch-latest
- java16/java16-openj9 - java16/java16-openj9
- java17-graalvm-ce - java17-graalvm-ce
- java20-graalvm, java20, java20-alpine - java20-graalvm
-4
View File
@@ -15,7 +15,6 @@ set -eu
: "${CF_FORCE_INCLUDE_MODS:=}" : "${CF_FORCE_INCLUDE_MODS:=}"
: "${CF_SET_LEVEL_FROM:=}" # --set-level-from : "${CF_SET_LEVEL_FROM:=}" # --set-level-from
: "${CF_OVERRIDES_SKIP_EXISTING:=false}" # --overrides-skip-existing : "${CF_OVERRIDES_SKIP_EXISTING:=false}" # --overrides-skip-existing
: "${CF_OVERRIDES_EXCLUSIONS:=}" # --overrides-exclusions
: "${CF_DOWNLOADS_REPO=$([ -d /downloads ] && echo '/downloads' || echo '')}" : "${CF_DOWNLOADS_REPO=$([ -d /downloads ] && echo '/downloads' || echo '')}"
: "${CF_MODPACK_MANIFEST:=}" : "${CF_MODPACK_MANIFEST:=}"
@@ -44,9 +43,6 @@ fi
if [[ ${CF_SET_LEVEL_FROM} ]]; then if [[ ${CF_SET_LEVEL_FROM} ]]; then
args+=(--set-level-from="$CF_SET_LEVEL_FROM") args+=(--set-level-from="$CF_SET_LEVEL_FROM")
fi fi
if [[ ${CF_OVERRIDES_EXCLUSIONS} ]]; then
args+=(--overrides-exclusions="$CF_OVERRIDES_EXCLUSIONS")
fi
args+=( args+=(
--force-synchronize="$CF_FORCE_SYNCHRONIZE" --force-synchronize="$CF_FORCE_SYNCHRONIZE"
--overrides-skip-existing="$CF_OVERRIDES_SKIP_EXISTING" --overrides-skip-existing="$CF_OVERRIDES_SKIP_EXISTING"
+1 -4
View File
@@ -115,10 +115,7 @@ function customizeServerProps {
setPropertiesArgs+=(--custom-properties "$CUSTOM_SERVER_PROPERTIES") setPropertiesArgs+=(--custom-properties "$CUSTOM_SERVER_PROPERTIES")
fi fi
if ! mc-image-helper set-properties "${setPropertiesArgs[@]}" "$SERVER_PROPERTIES"; then mc-image-helper set-properties "${setPropertiesArgs[@]}" "$SERVER_PROPERTIES"
log "ERROR: failed to update server.properties"
exit 1
fi
} }