Compare commits

..

33 Commits

Author SHA1 Message Date
Geoff Bourne
6e1ba3667c Auto-merging via docker-versions-create 2021-05-19 20:18:57 -05:00
Geoff Bourne
0c2f8b903b Auto-merging via docker-versions-create 2021-05-15 12:40:56 -05:00
Geoff Bourne
b9335d9cd6 Auto-merging via docker-versions-create 2021-05-06 20:12:25 -05:00
Geoff Bourne
0d92092b90 Auto-merging via docker-versions-create 2021-04-30 14:27:40 -05:00
Geoff Bourne
e653a41b3f Auto-merging via docker-versions-create 2021-04-30 11:11:19 -05:00
Geoff Bourne
82e63c54c4 Auto-merging via docker-versions-create 2021-04-28 16:50:55 -05:00
Geoff Bourne
f9c573f598 Auto-merging via docker-versions-create 2021-04-26 08:20:41 -05:00
Geoff Bourne
bf8b9cf20d Auto-merging via docker-versions-create 2021-04-24 13:42:07 -05:00
Geoff Bourne
0dd5a412d9 Auto-merging via docker-versions-create 2021-04-23 21:02:46 -05:00
Geoff Bourne
b389561091 Auto-merging via docker-versions-create 2021-04-18 13:29:12 -05:00
Geoff Bourne
6ee055761d Merge branch 'master' into java8 2021-04-11 10:41:32 -05:00
Geoff Bourne
49f9ff645e Auto-merging via docker-versions-create 2021-04-11 10:08:47 -05:00
Geoff Bourne
004cbdb9f7 Auto-merging via docker-versions-create 2021-04-08 19:12:56 -05:00
Geoff Bourne
45856a1a81 Auto-merging via docker-versions-create 2021-04-01 16:30:55 -05:00
Geoff Bourne
1e615e76e8 Merge branch 'master' into java8
# Conflicts:
#	start-configuration
#	start-deployCF
2021-03-18 19:58:16 -05:00
Geoff Bourne
1c85a685de Added support for CF modpacks using settings.cfg
#772 #800
2021-03-14 15:02:40 -05:00
Geoff Bourne
7cd207f40b docs: Added more info about getbukkit's weird 1.8 file naming
#103
2021-03-13 16:54:56 -06:00
Geoff Bourne
140a8aa90c Merge branch 'master' into java8 2021-03-11 19:40:26 -06:00
Geoff Bourne
76dcff9d18 Merge branch 'master' into java8 2021-03-11 17:23:48 -06:00
Geoff Bourne
a9a86d249b Merge branch 'master' into java8
# Conflicts:
#	start-configuration
2021-03-06 16:23:07 -06:00
Geoff Bourne
595760d301 Shifted PATH-fix earlier in startup 2021-03-06 16:04:06 -06:00
Geoff Bourne
6d3f194ce3 Merge from master 2021-02-27 20:47:00 -06:00
Geoff Bourne
21c1620f0c misc: java is actually found in /usr/bin by default 2021-02-11 15:05:45 -06:00
Geoff Bourne
e78e5af96d Fix PATH to include java when needed 2021-02-10 14:49:13 -06:00
Geoff Bourne
0fb9700fc7 Auto-merging via docker-versions-create 2021-02-10 14:01:35 -06:00
Geoff Bourne
18925ef32c Merged latest from master 2021-02-08 21:16:50 -06:00
Geoff Bourne
f06b990f8a Auto-merging via docker-versions-create 2021-02-07 18:03:40 -06:00
Geoff Bourne
75844ae81a Fix java8 base image to actually be Java 8
#753
2021-02-07 11:10:38 -06:00
Geoff Bourne
6bb2323c46 Auto-merging docker-versions-create.sh
CONFLICT (content): Merge conflict in docker-versions-create.sh
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
2021-02-07 09:07:30 -06:00
Geoff Bourne
7814ca21b5 Merge branch 'master' into java8
# Conflicts:
#	README.md
#	start-configuration
2021-01-30 18:56:33 -06:00
Geoff Bourne
b8806629ec Merged latest from master 2021-01-30 16:48:11 -06:00
Geoff Bourne
4a7f838a0f Upgraded mainline/latest to Java 11 2021-01-30 16:16:36 -06:00
Geoff Bourne
2d07dee4df Prepared forge branch's Dockerfile 2021-01-30 15:58:03 -06:00
19 changed files with 315 additions and 415 deletions

View File

@@ -2,22 +2,14 @@ name: Build and publish multiarch
on: on:
push: push:
branches: branches:
- master - multiarch
- "*-multiarch" - multiarch-latest
- "multiarch*" - java*
- java8-openj9
- java11*
- java15*
- java16*
- test/multiarch/* - test/multiarch/*
tags: tags:
- "[0-9]+.[0-9]+.[0-9]+" - "[0-9]+.[0-9]+.[0-9]+-multiarch"
- "[0-9]+.[0-9]+.[0-9]+-multiarch*" - "[0-9]+.[0-9]+.[0-9]+-multiarch-latest"
- "[0-9]+.[0-9]+.[0-9]+-*multiarch" - "[0-9]+.[0-9]+.[0-9]+-java*"
- "[0-9]+.[0-9]+.[0-9]+-java8-openj9"
- "[0-9]+.[0-9]+.[0-9]+-java11*"
- "[0-9]+.[0-9]+.[0-9]+-java15"
- "[0-9]+.[0-9]+.[0-9]+-java16*"
paths-ignore: paths-ignore:
- "*.md" - "*.md"
- "docs/**" - "docs/**"
@@ -26,24 +18,29 @@ on:
jobs: jobs:
docker-buildx: docker-buildx:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
env:
CACHE_NAME: java15
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2.3.4 uses: actions/checkout@v2.3.4
- name: Docker meta - name: Prepare
id: meta id: prep
uses: docker/metadata-action@v3 run: |
with: DOCKER_IMAGE=itzg/minecraft-server
images: | VERSION=edge
itzg/minecraft-server if [[ $GITHUB_REF == refs/tags/* ]]; then
tags: | VERSION=${GITHUB_REF#refs/tags/}
type=ref,event=branch fi
type=ref,event=tag if [[ $GITHUB_REF == refs/heads/* ]]; then
type=edge,branch=master VERSION=${GITHUB_REF#refs/heads/}
flavor: | if [[ $VERSION == master ]]; then
latest=false VERSION=latest
fi
fi
TAGS="${DOCKER_IMAGE}:${VERSION//\//-}"
echo ::set-output name=tags::${TAGS}
echo ::set-output name=cache_from::${TAGS}
echo ::set-output name=version::${VERSION//\//-}
echo ::set-output name=cache_version::${VERSION//\//-}
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
@@ -52,10 +49,9 @@ jobs:
uses: actions/cache@v2.1.5 uses: actions/cache@v2.1.5
with: with:
path: /tmp/.buildx-cache path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ env.CACHE_NAME }}-${{ github.sha }} key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-buildx-${{ env.CACHE_NAME }}- ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-
${{ runner.os }}-buildx-
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1.1.0 uses: docker/setup-qemu-action@v1.1.0
@@ -71,14 +67,19 @@ jobs:
uses: docker/build-push-action@v2.4.0 uses: docker/build-push-action@v2.4.0
with: with:
context: . context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64 platforms: linux/amd64,linux/arm/v7,linux/arm64
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.prep.outputs.tags }}
# ensure latest base image is used # ensure latest base image is used
pull: true pull: true
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
labels: ${{ steps.meta.outputs.labels }} labels: |
org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
org.opencontainers.image.source=https://github.com/itzg/docker-minecraft-server
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Image digest - name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}

View File

@@ -17,4 +17,4 @@ jobs:
./gh-md-toc --insert --no-backup README.md ./gh-md-toc --insert --no-backup README.md
- uses: stefanzweifel/git-auto-commit-action@v4.11.0 - uses: stefanzweifel/git-auto-commit-action@v4.11.0
with: with:
commit_message: "docs: Auto update markdown TOC" commit_message: Auto update markdown TOC

View File

@@ -3,12 +3,14 @@ name: Build and Publish
on: on:
push: push:
branches: branches:
- master
- java8 - java8
- openj9 - openj9
- openj9-11 - openj9-11
- adopt11 - adopt11
- test/* - test/*
tags: tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-java8" - "[0-9]+.[0-9]+.[0-9]+-java8"
- "[0-9]+.[0-9]+.[0-9]+-openj9" - "[0-9]+.[0-9]+.[0-9]+-openj9"
- "[0-9]+.[0-9]+.[0-9]+-openj9-11" - "[0-9]+.[0-9]+.[0-9]+-openj9-11"
@@ -29,8 +31,6 @@ jobs:
needs: needs:
- test - test
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
env:
CACHE_NAME: java15
steps: steps:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
@@ -62,9 +62,9 @@ jobs:
uses: actions/cache@v2.1.5 uses: actions/cache@v2.1.5
with: with:
path: /tmp/.buildx-cache path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ env.CACHE_NAME }}-${{ github.sha }} key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-buildx-${{ env.CACHE_NAME }}- ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-
${{ runner.os }}-buildx- ${{ runner.os }}-buildx-
- name: Login to DockerHub - name: Login to DockerHub

View File

@@ -1,11 +0,0 @@
Ensure buildx/BuildKit support is enabled and run:
```shell script
docker buildx build --platform=linux/arm64 --platform=linux/arm/v7 --platform=linux/amd64 --tag itzg/minecraft-server:multiarch --push .
```
To build for local testing, use:
```shell script
docker buildx build --platform=linux/amd64 --tag mc-multiarch --load .
```

View File

@@ -1,29 +1,29 @@
FROM adoptopenjdk:15-jre FROM openjdk:8u212-jre-alpine
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>" LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
RUN apt-get update \ RUN apk add --no-cache -U \
&& DEBIAN_FRONTEND=noninteractive \ openssl \
apt-get install -y \ imagemagick \
imagemagick \ lsof \
gosu \ su-exec \
sudo \ shadow \
net-tools \ bash \
curl wget \ curl iputils wget \
git \ git \
jq \ jq \
dos2unix \ mysql-client \
mysql-client \ tzdata \
tzdata \ rsync \
rsync \ nano \
nano \ sudo \
unzip \ knock \
knockd \ ttf-dejavu
ttf-dejavu \
&& apt-get clean
RUN addgroup --gid 1000 minecraft \ RUN addgroup -g 1000 minecraft \
&& adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft && adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
&& mkdir -m 777 /data \
&& chown minecraft:minecraft /data /home/minecraft
COPY files/sudoers* /etc/sudoers.d COPY files/sudoers* /etc/sudoers.d
@@ -31,9 +31,9 @@ EXPOSE 25565 25575
# hook into docker BuildKit --platform support # hook into docker BuildKit --platform support
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope # see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETOS ARG TARGETOS=linux
ARG TARGETARCH ARG TARGETARCH=amd64
ARG TARGETVARIANT ARG TARGETVARIANT=""
ARG EASY_ADD_VER=0.7.1 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 ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
@@ -69,7 +69,7 @@ WORKDIR /data
STOPSIGNAL SIGTERM STOPSIGNAL SIGTERM
ENV UID=1000 GID=1000 \ ENV UID=1000 GID=1000 \
MEMORY="1G" \ JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
TYPE=VANILLA VERSION=LATEST \ TYPE=VANILLA VERSION=LATEST \
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \ ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \ SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
@@ -84,6 +84,5 @@ RUN dos2unix /start* && chmod +x /start*
RUN dos2unix /health.sh && chmod +x /health.sh RUN dos2unix /health.sh && chmod +x /health.sh
RUN dos2unix /autopause/* && chmod +x /autopause/*.sh RUN dos2unix /autopause/* && chmod +x /autopause/*.sh
ENTRYPOINT [ "/start" ] ENTRYPOINT [ "/start" ]
HEALTHCHECK --start-period=1m CMD /health.sh HEALTHCHECK --start-period=1m CMD /health.sh

448
README.md
View File

@@ -56,7 +56,6 @@ By default, the container will download the latest version of the "vanilla" [Min
* [Helm Charts](#helm-charts) * [Helm Charts](#helm-charts)
* [Examples](#examples) * [Examples](#examples)
* [Amazon Web Services (AWS) Deployment](#amazon-web-services-aws-deployment) * [Amazon Web Services (AWS) Deployment](#amazon-web-services-aws-deployment)
* [Using Docker Compose](#using-docker-compose)
* [Server types](#server-types) * [Server types](#server-types)
* [Running a Forge Server](#running-a-forge-server) * [Running a Forge Server](#running-a-forge-server)
* [Running a Bukkit/Spigot server](#running-a-bukkitspigot-server) * [Running a Bukkit/Spigot server](#running-a-bukkitspigot-server)
@@ -79,15 +78,12 @@ By default, the container will download the latest version of the "vanilla" [Min
* [Modpack data directory](#modpack-data-directory) * [Modpack data directory](#modpack-data-directory)
* [Buggy start scripts](#buggy-start-scripts) * [Buggy start scripts](#buggy-start-scripts)
* [Fixing "unable to launch forgemodloader"](#fixing-unable-to-launch-forgemodloader) * [Fixing "unable to launch forgemodloader"](#fixing-unable-to-launch-forgemodloader)
* [Working with mods and plugins](#working-with-mods-and-plugins) * [Optional plugins, mods, and config attach points](#optional-plugins-mods-and-config-attach-points)
* [Optional plugins, mods, and config attach points](#optional-plugins-mods-and-config-attach-points) * [Auto-downloading SpigotMC/Bukkit/PaperMC plugins](#auto-downloading-spigotmcbukkitpapermc-plugins)
* [Auto-downloading SpigotMC/Bukkit/PaperMC plugins](#auto-downloading-spigotmcbukkitpapermc-plugins) * [Replacing variables inside configs](#replacing-variables-inside-configs)
* [Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers](#downloadable-modplugin-pack-for-forge-bukkit-and-spigot-servers) * [Running with a custom server JAR](#running-with-a-custom-server-jar)
* [Remove old mods/plugins](#remove-old-modsplugins) * [Force re-download of the server file](#force-re-download-of-the-server-file)
* [Working with world data](#working-with-world-data) * [Using Docker Compose](#using-docker-compose)
* [Downloadable world](#downloadable-world)
* [Cloning world from a container path](#cloning-world-from-a-container-path)
* [Overwrite world on start](#overwrite-world-on-start)
* [Server configuration](#server-configuration) * [Server configuration](#server-configuration)
* [Server name](#server-name) * [Server name](#server-name)
* [Server port](#server-port) * [Server port](#server-port)
@@ -120,13 +116,15 @@ By default, the container will download the latest version of the "vanilla" [Min
* [Level Type and Generator Settings](#level-type-and-generator-settings) * [Level Type and Generator Settings](#level-type-and-generator-settings)
* [Custom Server Resource Pack](#custom-server-resource-pack) * [Custom Server Resource Pack](#custom-server-resource-pack)
* [World Save Name](#world-save-name) * [World Save Name](#world-save-name)
* [Downloadable world](#downloadable-world)
* [Cloning world from a container path](#cloning-world-from-a-container-path)
* [Overwrite world on start](#overwrite-world-on-start)
* [Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers](#downloadable-modplugin-pack-for-forge-bukkit-and-spigot-servers)
* [Remove old mods/plugins](#remove-old-modsplugins)
* [Online mode](#online-mode) * [Online mode](#online-mode)
* [Allow flight](#allow-flight) * [Allow flight](#allow-flight)
* [Other server property mappings](#other-server-property-mappings) * [Other server property mappings](#other-server-property-mappings)
* [Miscellaneous Options](#miscellaneous-options) * [Miscellaneous Options](#miscellaneous-options)
* [Replacing variables inside configs](#replacing-variables-inside-configs)
* [Running with a custom server JAR](#running-with-a-custom-server-jar)
* [Force re-download of the server file](#force-re-download-of-the-server-file)
* [Running as alternate user/group ID](#running-as-alternate-usergroup-id) * [Running as alternate user/group ID](#running-as-alternate-usergroup-id)
* [Memory Limit](#memory-limit) * [Memory Limit](#memory-limit)
* [JVM Options](#jvm-options) * [JVM Options](#jvm-options)
@@ -145,7 +143,7 @@ By default, the container will download the latest version of the "vanilla" [Min
* [Enabling Autopause](#enabling-autopause) * [Enabling Autopause](#enabling-autopause)
* [Running on RaspberryPi](#running-on-raspberrypi) * [Running on RaspberryPi](#running-on-raspberrypi)
<!-- Added by: runner, at: Sat May 22 13:59:04 UTC 2021 --> <!-- Added by: runner, at: Thu May 20 01:17:11 UTC 2021 -->
<!--te--> <!--te-->
@@ -270,20 +268,22 @@ the server jar remain in the `/data` directory. It is safe to remove those._
## Running Minecraft server on different Java version ## Running Minecraft server on different Java version
> **NOTE** [as of snapshot 21W19A](https://www.minecraft.net/en-us/article/minecraft-snapshot-21w19a), Java 16 is now required. Please use `itzg/minecraft-server:java16` for that version and newer. Consideration of changing the `latest` will be made after 1.17 releases.
To use a different version of Java, please use a docker tag to run your Minecraft server. To use a different version of Java, please use a docker tag to run your Minecraft server.
| Tag name | Java version | Linux | JVM Type | Architecture | | Tag name | Java version | Linux | JVM Type | Architecture |
| -------------- | -------------|--------|----------|-------------------| | -------------- | -------------|--------|----------|-------------------|
| latest | 16 | Debian | Hotspot | amd64,arm64,armv7 | | latest | 11 | Alpine | Hotspot | amd64 |
| edge | 16 | Debian | Hotspot | amd64,arm64,armv7 |
| java8 | 8 | Alpine | Hotspot | amd64 | | java8 | 8 | Alpine | Hotspot | amd64 |
| java8-multiarch | 8 | Debian | Hotspot | amd64,arm64,armv7 | | java8-multiarch | 8 | Debian | Hotspot | amd64,arm64,armv7 |
| java8-openj9 | 8 | Debian | OpenJ9 | amd64 |
| java11 | 11 | Debian | Hotspot | amd64,arm64,armv7 |
| java11-openj9 | 11 | Debian | OpenJ9 | amd64 |
| java15 | 15 | Debian | Hotspot | amd64,arm64,armv7 | | java15 | 15 | Debian | Hotspot | amd64,arm64,armv7 |
| java15-openj9 | 15 | Debian | OpenJ9 | amd64,arm64 |
| java16 | 16 | Debian | Hotspot | amd64,arm64,armv7 | | java16 | 16 | Debian | Hotspot | amd64,arm64,armv7 |
| java16-openj9 | 16 | Debian | OpenJ9 | amd64 | | adopt11 | 11 | Alpine | Hotspot | amd64 |
| openj9 | 8 | Alpine | OpenJ9 | amd64 |
| openj9-11 | 11 | Alpine | OpenJ9 | amd64 |
| multiarch | 11 | Debian | Hotspot | amd64,arm64,armv7 |
| multiarch-latest | 15+ | Debian | Hotspot | amd64,arm64,armv7 | | multiarch-latest | 15+ | Debian | Hotspot | amd64,arm64,armv7 |
For example, to use Java version 15 on any supported architecture: For example, to use Java version 15 on any supported architecture:
@@ -337,37 +337,6 @@ The [examples directory](https://github.com/itzg/docker-minecraft-server/tree/ma
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. 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.
### Using Docker Compose
Rather than type the server options below, the port mappings above, etc
every time you want to create new Minecraft server, you can now use
[Docker Compose](https://docs.docker.com/compose/). Start with a
`docker-compose.yml` file like the following:
```yml
version: "3.8"
minecraft-server:
image: itzg/minecraft-server
ports:
- "25565:25565"
environment:
EULA: "TRUE"
tty: true
stdin_open: true
restart: always
```
and in the same directory as that file run
docker-compose up -d
Now, go play...or adjust the `environment` section to configure
this server instance.
## Server types ## Server types
### Running a Forge Server ### Running a Forge Server
@@ -497,7 +466,7 @@ A [Magma](https://magmafoundation.org/) server, which is a combination of Forge
### Running a Mohist server ### Running a Mohist server
A [Mohist](https://github.com/MohistMC/Mohist) server can be used with A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with
-e TYPE=MOHIST -e TYPE=MOHIST
@@ -643,9 +612,7 @@ then you apply a workaround by adding this to the run invocation:
-e FTB_LEGACYJAVAFIXER=true -e FTB_LEGACYJAVAFIXER=true
## Working with mods and plugins ## Optional plugins, mods, and config attach points
### Optional plugins, mods, and config attach points
There are optional volume paths that can be attached to supply content to be copied into the data area: There are optional volume paths that can be attached to supply content to be copied into the data area:
@@ -668,7 +635,7 @@ These paths work well if you want to have a common set of modules in a separate
> For more flexibility with mods/plugins preparation, you can declare directories to use in [the `MODS` variable](#downloadable-modplugin-pack-for-forge-bukkit-and-spigot-servers) > For more flexibility with mods/plugins preparation, you can declare directories to use in [the `MODS` variable](#downloadable-modplugin-pack-for-forge-bukkit-and-spigot-servers)
### Auto-downloading SpigotMC/Bukkit/PaperMC plugins ## Auto-downloading SpigotMC/Bukkit/PaperMC plugins
The `SPIGET_RESOURCES` variable can be set with a comma-separated list of SpigotMC resource IDs to automatically download [SpigotMC resources/plugins](https://www.spigotmc.org/resources/) using [the spiget API](https://spiget.org/). Resources that are zip files will be expanded into the plugins directory and resources that are simply jar files will be moved there. The `SPIGET_RESOURCES` variable can be set with a comma-separated list of SpigotMC resource IDs to automatically download [SpigotMC resources/plugins](https://www.spigotmc.org/resources/) using [the spiget API](https://spiget.org/). Resources that are zip files will be expanded into the plugins directory and resources that are simply jar files will be moved there.
@@ -683,65 +650,159 @@ For example, the following will auto-download the [EssentialsX](https://www.spig
-e SPIGET_RESOURCES=9089,34315 -e SPIGET_RESOURCES=9089,34315
### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers ## Replacing variables inside configs
Like the `WORLD` option above, you can specify the URL or path of a "mod pack" Sometimes you have mods or plugins that require configuration information that is only available at runtime.
to download and install into `mods` for Forge or `plugins` for Bukkit/Spigot. For example if you need to configure a plugin to connect to a database,
To use this option pass the environment variable `MODPACK`, such as you don't want to include this information in your Git repository or Docker image.
Or maybe you have some runtime information like the server name that needs to be set
in your config files after the container starts.
docker run -d -e MODPACK=http://www.example.com/mods/modpack.zip ... For those cases there is the option to replace defined variables inside your configs
with environment variables defined at container runtime.
**NOTE:** The referenced URL must be a zip file with one or more jar files at the If you set the enviroment variable `REPLACE_ENV_VARIABLES` to `TRUE` the startup script
top level of the zip archive. Make sure the jars are compatible with the will go thru all files inside your `/data` volume and replace variables that match your
particular `TYPE` of server you are running. defined environment variables. Variables that you want to replace need to be wrapped
inside `${YOUR_VARIABLE}` curly brackets and prefixed with a dollar sign. This is the regular
syntax for enviromment variables inside strings or config files.
You may also download or copy over individual mods using the `MODS` environment variable. `MODS` contains a comma-separated list of Optionally you can also define a prefix to only match predefined environment variables.
- URL of a jar file
- container path to a jar file
- container path to a directory containing jar files
docker run -d -e MODS=https://www.example.com/mods/mod1.jar,/plugins/common,/plugins/special/mod2.jar ... `ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
### Remove old mods/plugins If you want use file for value (like when use secrets) you can add suffix `_FILE` to your variable name (in run command).
When the option above is specified (`MODPACK`) you can also instruct script to There are some limitations to what characters you can use.
delete old mods/plugins prior to installing new ones. This behaviour is desirable
in case you want to upgrade mods/plugins from downloaded zip file.
To use this option pass the environment variable `REMOVE_OLD_MODS="TRUE"`, such as
docker run -d -e REMOVE_OLD_MODS="TRUE" -e MODPACK=http://www.example.com/mods/modpack.zip ... | Type | Allowed Characters |
| ----- | ------------------- |
| Name | `0-9a-zA-Z_-` |
| Value | `0-9a-zA-Z_-:/=?.+` |
**WARNING:** All content of the `mods` or `plugins` directory will be deleted Variables will be replaced in files with the following extensions:
before unpacking new content from the MODPACK or MODS. `.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`.
## Working with world data Specific files can be excluded by listing their name (without path) in the variable `REPLACE_ENV_VARIABLES_EXCLUDES`.
### Downloadable world
Instead of mounting the `/data` volume, you can instead specify the URL of a ZIP file containing an archived world. It will be searched for a file `level.dat` and the containing subdirectory moved to the directory named by `$LEVEL`. This means that most of the archived Minecraft worlds downloadable from the Internet will already be in the correct format.
docker run -d -e WORLD=http://www.example.com/worlds/MySave.zip ...
**NOTE:** This URL must be accessible from inside the container. Therefore,
you should use an IP address or a globally resolvable FQDN, or else the
name of a linked container.
**NOTE:** If the archive contains more than one `level.dat`, then the one to select can be picked with `WORLD_INDEX`, which defaults to 1.
### Cloning world from a container path
The `WORLD` option can also be used to reference a directory or zip file that will be used as a source to clone or unzip the world directory.
For example, the following would initially clone the world's content
from `/worlds/basic`. Also notice in the example that you can use a
read-only volume attachment to ensure the clone source remains pristine.
Paths can be excluded by listing them in the variable `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. Path
excludes are recursive. Here is an example:
``` ```
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic REPLACE_ENV_VARIABLES_EXCLUDE_PATHS="/data/plugins/Essentials/userdata /data/plugins/MyPlugin"
``` ```
### Overwrite world on start Here is a full example where we want to replace values inside a `database.yml`.
The world will only be downloaded or copied if it doesn't exist already. Set `FORCE_WORLD_COPY=TRUE` to force overwrite the world on every server start.
```yml
---
database:
host: ${CFG_DB_HOST}
name: ${CFG_DB_NAME}
password: ${CFG_DB_PASSWORD}
```
This is how your `docker-compose.yml` file could look like:
```yml
version: "3.8"
# Other docker-compose examples in /examples
services:
minecraft:
image: itzg/minecraft-server
ports:
- "25565:25565"
volumes:
- "mc:/data"
environment:
EULA: "TRUE"
ENABLE_RCON: "true"
RCON_PASSWORD: "testing"
RCON_PORT: 28016
# enable env variable replacement
REPLACE_ENV_VARIABLES: "TRUE"
# define an optional prefix for your env variables you want to replace
ENV_VARIABLE_PREFIX: "CFG_"
# and here are the actual variables
CFG_DB_HOST: "http://localhost:3306"
CFG_DB_NAME: "minecraft"
CFG_DB_PASSWORD_FILE: "/run/secrets/db_password"
restart: always
rcon:
image: itzg/rcon
ports:
- "4326:4326"
- "4327:4327"
volumes:
- "rcon:/opt/rcon-web-admin/db"
volumes:
mc:
rcon:
secrets:
db_password:
file: ./db_password
```
The content of `db_password`:
ug23u3bg39o-ogADSs
## Running with a custom server JAR
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
JAR via `CUSTOM_SERVER`. It can either be a URL or a container path to an existing JAR file.
If it is a URL, it will only be downloaded into the `/data` directory if it wasn't already. As
such, if you need to upgrade or re-download the JAR, then you will need to stop the container,
remove the file from the container's `/data` directory, and start again.
## Force re-download of the server file
For VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, CURSEFORGE, SPONGEVANILLA server types, set
`$FORCE_REDOWNLOAD` to some value (e.g. 'true) to force a re-download of the server file for
the particular server type. by adding a `-e FORCE_REDOWNLOAD=true` to your command-line.
For example, with PaperSpigot, it would look something like this:
```
docker run -d -v /path/on/host:/data \
-e TYPE=PAPER -e FORCE_REDOWNLOAD=true \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
## Using Docker Compose
Rather than type the server options below, the port mappings above, etc
every time you want to create new Minecraft server, you can now use
[Docker Compose](https://docs.docker.com/compose/). Start with a
`docker-compose.yml` file like the following:
```yml
version: "3.8"
minecraft-server:
image: itzg/minecraft-server
ports:
- "25565:25565"
environment:
EULA: "TRUE"
tty: true
stdin_open: true
restart: always
```
and in the same directory as that file run
docker-compose up -d
Now, go play...or adjust the `environment` section to configure
this server instance.
## Server configuration ## Server configuration
@@ -1021,6 +1082,64 @@ where the default is "world":
**NOTE:** if running multiple containers be sure to either specify a different `-v` host directory for each **NOTE:** if running multiple containers be sure to either specify a different `-v` host directory for each
`LEVEL` in use or don't use `-v` and the container's filesystem will keep things encapsulated. `LEVEL` in use or don't use `-v` and the container's filesystem will keep things encapsulated.
### Downloadable world
Instead of mounting the `/data` volume, you can instead specify the URL of a ZIP file containing an archived world. It will be searched for a file `level.dat` and the containing subdirectory moved to the directory named by `$LEVEL`. This means that most of the archived Minecraft worlds downloadable from the Internet will already be in the correct format.
docker run -d -e WORLD=http://www.example.com/worlds/MySave.zip ...
**NOTE:** This URL must be accessible from inside the container. Therefore,
you should use an IP address or a globally resolvable FQDN, or else the
name of a linked container.
**NOTE:** If the archive contains more than one `level.dat`, then the one to select can be picked with `WORLD_INDEX`, which defaults to 1.
### Cloning world from a container path
The `WORLD` option can also be used to reference a directory or zip file that will be used as a source to clone or unzip the world directory.
For example, the following would initially clone the world's content
from `/worlds/basic`. Also notice in the example that you can use a
read-only volume attachment to ensure the clone source remains pristine.
```
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
```
### Overwrite world on start
The world will only be downloaded or copied if it doesn't exist already. Set `FORCE_WORLD_COPY=TRUE` to force overwrite the world on every server start.
### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers
Like the `WORLD` option above, you can specify the URL or path of a "mod pack"
to download and install into `mods` for Forge or `plugins` for Bukkit/Spigot.
To use this option pass the environment variable `MODPACK`, such as
docker run -d -e MODPACK=http://www.example.com/mods/modpack.zip ...
**NOTE:** The referenced URL must be a zip file with one or more jar files at the
top level of the zip archive. Make sure the jars are compatible with the
particular `TYPE` of server you are running.
You may also download or copy over individual mods using the `MODS` environment variable. `MODS` contains a comma-separated list of
- URL of a jar file
- container path to a jar file
- container path to a directory containing jar files
docker run -d -e MODS=https://www.example.com/mods/mod1.jar,/plugins/common,/plugins/special/mod2.jar ...
### Remove old mods/plugins
When the option above is specified (`MODPACK`) you can also instruct script to
delete old mods/plugins prior to installing new ones. This behaviour is desirable
in case you want to upgrade mods/plugins from downloaded zip file.
To use this option pass the environment variable `REMOVE_OLD_MODS="TRUE"`, such as
docker run -d -e REMOVE_OLD_MODS="TRUE" -e MODPACK=http://www.example.com/mods/modpack.zip ...
**WARNING:** All content of the `mods` or `plugins` directory will be deleted
before unpacking new content from the MODPACK or MODS.
### Online mode ### Online mode
By default, server checks connecting players against Minecraft's account database. If you want to create an offline server or your server is not connected to the internet, you can disable the server to try connecting to minecraft.net to authenticate players with environment variable `ONLINE_MODE`, like this By default, server checks connecting players against Minecraft's account database. If you want to create an offline server or your server is not connected to the internet, you can disable the server to try connecting to minecraft.net to authenticate players with environment variable `ONLINE_MODE`, like this
@@ -1053,129 +1172,6 @@ Allows users to use flight on your server while in Survival mode, if they have a
## Miscellaneous Options ## Miscellaneous Options
### Replacing variables inside configs
Sometimes you have mods or plugins that require configuration information that is only available at runtime.
For example if you need to configure a plugin to connect to a database,
you don't want to include this information in your Git repository or Docker image.
Or maybe you have some runtime information like the server name that needs to be set
in your config files after the container starts.
For those cases there is the option to replace defined variables inside your configs
with environment variables defined at container runtime.
If you set the enviroment variable `REPLACE_ENV_VARIABLES` to `TRUE` the startup script
will go thru all files inside your `/data` volume and replace variables that match your
defined environment variables. Variables that you want to replace need to be wrapped
inside `${YOUR_VARIABLE}` curly brackets and prefixed with a dollar sign. This is the regular
syntax for enviromment variables inside strings or config files.
Optionally you can also define a prefix to only match predefined environment variables.
`ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
If you want use file for value (like when use secrets) you can add suffix `_FILE` to your variable name (in run command).
There are some limitations to what characters you can use.
| Type | Allowed Characters |
| ----- | ------------------- |
| Name | `0-9a-zA-Z_-` |
| Value | `0-9a-zA-Z_-:/=?.+` |
Variables will be replaced in files with the following extensions:
`.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`.
Specific files can be excluded by listing their name (without path) in the variable `REPLACE_ENV_VARIABLES_EXCLUDES`.
Paths can be excluded by listing them in the variable `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. Path
excludes are recursive. Here is an example:
```
REPLACE_ENV_VARIABLES_EXCLUDE_PATHS="/data/plugins/Essentials/userdata /data/plugins/MyPlugin"
```
Here is a full example where we want to replace values inside a `database.yml`.
```yml
---
database:
host: ${CFG_DB_HOST}
name: ${CFG_DB_NAME}
password: ${CFG_DB_PASSWORD}
```
This is how your `docker-compose.yml` file could look like:
```yml
version: "3.8"
# Other docker-compose examples in /examples
services:
minecraft:
image: itzg/minecraft-server
ports:
- "25565:25565"
volumes:
- "mc:/data"
environment:
EULA: "TRUE"
ENABLE_RCON: "true"
RCON_PASSWORD: "testing"
RCON_PORT: 28016
# enable env variable replacement
REPLACE_ENV_VARIABLES: "TRUE"
# define an optional prefix for your env variables you want to replace
ENV_VARIABLE_PREFIX: "CFG_"
# and here are the actual variables
CFG_DB_HOST: "http://localhost:3306"
CFG_DB_NAME: "minecraft"
CFG_DB_PASSWORD_FILE: "/run/secrets/db_password"
restart: always
rcon:
image: itzg/rcon
ports:
- "4326:4326"
- "4327:4327"
volumes:
- "rcon:/opt/rcon-web-admin/db"
volumes:
mc:
rcon:
secrets:
db_password:
file: ./db_password
```
The content of `db_password`:
ug23u3bg39o-ogADSs
### Running with a custom server JAR
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
JAR via `CUSTOM_SERVER`. It can either be a URL or a container path to an existing JAR file.
If it is a URL, it will only be downloaded into the `/data` directory if it wasn't already. As
such, if you need to upgrade or re-download the JAR, then you will need to stop the container,
remove the file from the container's `/data` directory, and start again.
### Force re-download of the server file
For VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, CURSEFORGE, SPONGEVANILLA server types, set
`$FORCE_REDOWNLOAD` to some value (e.g. 'true) to force a re-download of the server file for
the particular server type. by adding a `-e FORCE_REDOWNLOAD=true` to your command-line.
For example, with PaperSpigot, it would look something like this:
```
docker run -d -v /path/on/host:/data \
-e TYPE=PAPER -e FORCE_REDOWNLOAD=true \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
### Running as alternate user/group ID ### Running as alternate user/group ID
By default, the container will switch to user ID 1000 and group ID 1000; By default, the container will switch to user ID 1000 and group ID 1000;
@@ -1340,7 +1336,9 @@ The following environment variables define the behaviour of auto-pausing:
## Running on RaspberryPi ## Running on RaspberryPi
To run this image on a RaspberryPi 3 B+, 4, or newer, use any of the image tags [list in the Java version section](#running-minecraft-server-on-different-java-version) that specify `armv7` for the architecture, which includes `itzg/minecraft-server:latest`. To run this image on a RaspberryPi 3 B+, 4, or newer, use any of the image tags [list in the Java version section](#running-minecraft-server-on-different-java-version) that specify `armv7` for the architecture, such as
itzg/minecraft-server:multiarch
> NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m` > NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m`

View File

@@ -4,12 +4,13 @@
branches_list=( branches_list=(
'java8' 'java8'
'java8-multiarch' 'java8-multiarch'
'java8-openj9' 'openj9'
'java11' 'openj9-11'
'java11-openj9' 'adopt11'
'java15' 'java15'
'java15-openj9'
'java16' 'java16'
'java16-openj9' 'multiarch'
'multiarch-latest' 'multiarch-latest'
) )

View File

View File

@@ -5,15 +5,15 @@ current_uptime() {
} }
java_running() { java_running() {
[[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]]
} }
java_process_exists() { java_process_exists() {
[[ -n "$(ps -ax -o comm | grep 'java')" ]] [[ -n "$(ps -a -o comm | grep 'java')" ]]
} }
rcon_client_exists() { rcon_client_exists() {
[[ -n "$(ps -ax -o comm | grep 'rcon-cli')" ]] [[ -n "$(ps -a -o comm | grep 'rcon-cli')" ]]
} }
mc_server_listening() { mc_server_listening() {

View File

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

View File

@@ -2,7 +2,7 @@
. /start-utils . /start-utils
if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then if [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then
# save world # save world
rcon-cli save-all >/dev/null rcon-cli save-all >/dev/null

View File

@@ -2,7 +2,7 @@
. /start-utils . /start-utils
if [[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; then if [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; then
logAutopauseAction "Knocked, resuming Java process" logAutopauseAction "Knocked, resuming Java process"
pkill -CONT java pkill -CONT java
fi fi

View File

@@ -5,7 +5,7 @@
if isTrue "${DISABLE_HEALTHCHECK}"; then if isTrue "${DISABLE_HEALTHCHECK}"; then
echo "Healthcheck disabled" echo "Healthcheck disabled"
exit 0 exit 0
elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
echo "Java process suspended by Autopause function" echo "Java process suspended by Autopause function"
exit 0 exit 0
else else

2
start
View File

@@ -40,7 +40,7 @@ if ! isTrue "${SKIP_SUDO:-false}" && [ $(id -u) = 0 ]; then
echo 'hosts: files dns' > /etc/nsswitch.conf echo 'hosts: files dns' > /etc/nsswitch.conf
fi fi
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@ exec su-exec ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
else else
exec ${SCRIPTS:-/}start-configuration $@ exec ${SCRIPTS:-/}start-configuration $@
fi fi

View File

@@ -13,8 +13,6 @@ shopt -s nullglob
#umask 002 #umask 002
export HOME=/data export HOME=/data
log "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
if [ ! -e /data/eula.txt ]; then if [ ! -e /data/eula.txt ]; then
if ! isTrue "$EULA"; then if ! isTrue "$EULA"; then
log "" log ""
@@ -30,6 +28,15 @@ if [ ! -e /data/eula.txt ]; then
fi fi
log "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
if ! touch /data/.verify_access; then
log "ERROR: /data doesn't seem to be writable. Please make sure attached directory is writable by uid=$(id -u)"
exit 2
fi
rm /data/.verify_access || true
if [[ $PROXY ]]; then if [[ $PROXY ]]; then
export http_proxy="$PROXY" export http_proxy="$PROXY"
export https_proxy="$PROXY" export https_proxy="$PROXY"
@@ -56,7 +63,7 @@ fi
if ! which java > /dev/null; then if ! which java > /dev/null; then
log "Fixing PATH to include java" log "Fixing PATH to include java"
PATH="${PATH}:/opt/java/openjdk/bin" PATH="${PATH}:/usr/bin"
fi fi
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
@@ -98,12 +105,6 @@ case "${TYPE^^}" in
;; ;;
FORGE) FORGE)
log "**********************************************************************"
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
log " since some mods require Java 8"
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
log " can be fixed with java8"
log "**********************************************************************"
exec ${SCRIPTS:-/}start-deployForge "$@" exec ${SCRIPTS:-/}start-deployForge "$@"
;; ;;
@@ -111,17 +112,7 @@ case "${TYPE^^}" in
exec ${SCRIPTS:-/}start-deployFabric "$@" exec ${SCRIPTS:-/}start-deployFabric "$@"
;; ;;
FTBA)
exec ${SCRIPTS:-/}start-deployFTBA "$@"
;;
FTB|CURSEFORGE) FTB|CURSEFORGE)
log "**********************************************************************"
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
log " since some mods require Java 8"
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
log " can be fixed with java8"
log "**********************************************************************"
exec ${SCRIPTS:-/}start-deployCF "$@" exec ${SCRIPTS:-/}start-deployCF "$@"
;; ;;

View File

@@ -1,75 +0,0 @@
#!/bin/bash
ftbInstallMarker=".ftb-installed"
. ${SCRIPTS:-/}start-utils
isDebugging && set -x
set -e
if ! [[ -v FTB_MODPACK_ID ]]; then
log "ERROR FTB_MODPACK_ID is required with TYPE=FTB"
exit 1
fi
if ! [[ ${FTB_MODPACK_ID} =~ [0-9]+ ]]; then
log "ERROR FTB_MODPACK_ID needs to be numeric"
exit 1
fi
if ! [[ -v FTB_MODPACK_VERSION_ID ]]; then
if ! FTB_MODPACK_VERSION_ID=$(curl -fsSL https://api.modpacks.ch/public/modpack/${FTB_MODPACK_ID} | jq -r '.versions | sort_by(.updated)[-1].id'); then
log "ERROR unable to resolve latest modpack version ID for modpack ${FTB_MODPACK_ID}"
exit 1
fi
elif ! [[ ${FTB_MODPACK_VERSION_ID} =~ [0-9]+ ]]; then
log "ERROR FTB_MODPACK_VERSION_ID needs to be numeric"
exit 1
fi
if ! [ -f "${ftbInstallMarker}" ] || [ $(cat "${ftbInstallMarker}") != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
ftbInstaller=/data/ftb-installer
if ! [[ -f "${ftbInstaller}" ]]; then
log "Downloading FTB installer"
curl -fsSL https://api.modpacks.ch/public/modpack/1/1/server/linux -o "${ftbInstaller}"
chmod +x "${ftbInstaller}"
fi
rm -rf forge*jar mods config libraries defaultconfigs changelogs
log "Installing modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID}"
${ftbInstaller} ${FTB_MODPACK_ID} ${FTB_MODPACK_VERSION_ID} --noscript --auto
rm -f forge*installer.jar
echo "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" > ${ftbInstallMarker}
writeEula
# some modpacks result in --w----r-- permissions
chmod a+r version.json
else
log "FTB modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID} is ready to go"
fi
isDebugging && cat version.json
forgeVersion=$(jq -r '.targets|unique[] | select(.name == "forge") | .version' version.json)
mcVersion=$(jq -r '.targets|unique[] | select(.name == "minecraft") | .version' version.json)
variants=(
forge-${mcVersion}-${forgeVersion}.jar
forge-${mcVersion}-${forgeVersion}-universal.jar
forge-${mcVersion}-${forgeVersion}-${mcVersion}-universal.jar
)
for f in ${variants[@]}; do
if [ -f $f ]; then
export SERVER=$f
break
fi
done
if ! [ -v SERVER ]; then
log "ERROR unable to locate the installed forge server jar"
ls *.jar
exit 2
fi
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetupWorld $@

View File

@@ -8,12 +8,12 @@ isDebugging && set -x
requireVar VANILLA_VERSION requireVar VANILLA_VERSION
: ${MOHIST_BUILD:=lastSuccessfulBuild} : ${MOHIST_BUILD:=lastSuccessfulBuild}
mohistJobs=https://ci.codemc.io/job/MohistMC/job/ mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/ mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}" log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}"
log " check https://ci.codemc.io/job/MohistMC/ for available versions" log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
log " and set VERSION accordingly" log " and set VERSION accordingly"
exit 1 exit 1
fi fi
@@ -26,7 +26,7 @@ buildRelPath=$(
baseName=$(basename "${buildRelPath}") baseName=$(basename "${buildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}" log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
log " check https://ci.codemc.io/job/MohistMC/ for available versions" log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
log " and set VERSION accordingly" log " and set VERSION accordingly"
exit 1 exit 1
fi fi

View File

@@ -246,4 +246,3 @@ else
exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java "${finalArgs[@]}" exec mc-server-runner ${bootstrapArgs} ${mcServerRunnerArgs} java "${finalArgs[@]}"
fi fi
fi fi

View File

@@ -10,9 +10,6 @@ services:
restart: "no" restart: "no"
build: build:
context: .. context: ..
args:
TARGETOS: linux
TARGETARCH: amd64
cache_from: cache_from:
- itzg/minecraft-server:latest - itzg/minecraft-server:latest
environment: environment: