mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-17 15:13:55 +00:00
Compare commits
55 Commits
2021.1.0-m
...
2021.4.0-j
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
090e624ebc | ||
|
|
eb12030975 | ||
|
|
e46af9d54c | ||
|
|
861faaa285 | ||
|
|
8312233a93 | ||
|
|
959bf73485 | ||
|
|
c8dc751b82 | ||
|
|
beeaf1a996 | ||
|
|
96aa1054dc | ||
|
|
7c862df92a | ||
|
|
e7937206af | ||
|
|
e49c1c2f01 | ||
|
|
081b2c11e4 | ||
|
|
f342f4aa98 | ||
|
|
57390b02ca | ||
|
|
4e73e69342 | ||
|
|
a698248dff | ||
|
|
c6ff80b71c | ||
|
|
37cad3f255 | ||
|
|
5700f36a6f | ||
|
|
34f800d815 | ||
|
|
b8ef6eba3f | ||
|
|
ffec50141a | ||
|
|
54027049d3 | ||
|
|
4c2829e3d2 | ||
|
|
69e308d420 | ||
|
|
ad46f10b55 | ||
|
|
cd0fdfc95b | ||
|
|
d95abfce82 | ||
|
|
942a125e04 | ||
|
|
cc5fe0859a | ||
|
|
a3677d5aa8 | ||
|
|
f927933c46 | ||
|
|
8f15aac6fc | ||
|
|
b519c43e16 | ||
|
|
5ab83bcb21 | ||
|
|
84ce3b4b47 | ||
|
|
02c8393bc6 | ||
|
|
b07c43a32f | ||
|
|
9469291731 | ||
|
|
ce1b337f7f | ||
|
|
ee8e1b9322 | ||
|
|
20bd5c4c36 | ||
|
|
de082d0fb2 | ||
|
|
3cc5cdbc06 | ||
|
|
b69ec47b18 | ||
|
|
51fc8e824d | ||
|
|
aff9031284 | ||
|
|
397d080da2 | ||
|
|
cb5d052829 | ||
|
|
0908d21bed | ||
|
|
4d878985d4 | ||
|
|
72d7d4a65e | ||
|
|
cb0add3b90 | ||
|
|
71a48ce10f |
28
.github/workflows/build-multiarch.yml
vendored
28
.github/workflows/build-multiarch.yml
vendored
@@ -3,15 +3,18 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- multiarch
|
||||
- java8-multiarch
|
||||
- multiarch-latest
|
||||
- "test-multiarch-.*"
|
||||
- java15
|
||||
- test/multiarch/*
|
||||
tags:
|
||||
- "[0-9]+.[0-9]+.[0-9]+-multiarch"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-multiarch-latest"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-java15"
|
||||
|
||||
jobs:
|
||||
docker-buildx:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2.2.0
|
||||
@@ -30,13 +33,23 @@ jobs:
|
||||
VERSION=latest
|
||||
fi
|
||||
fi
|
||||
TAGS="${DOCKER_IMAGE}:${VERSION}"
|
||||
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
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
@@ -55,8 +68,13 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
cache-from: type=registry,ref=${{ steps.prep.outputs.cache_from }}
|
||||
cache-to: type=inline
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
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
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
||||
80
.github/workflows/main.yml
vendored
80
.github/workflows/main.yml
vendored
@@ -4,24 +4,22 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- java8
|
||||
- openj9
|
||||
- openj9-nightly
|
||||
- openj9-11
|
||||
- adopt11
|
||||
- adopt13
|
||||
- adopt14
|
||||
- adopt15
|
||||
- test/*
|
||||
tags:
|
||||
- "[0-9]+.[0-9]+.[0-9]+"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-java8"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-openj9"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-openj9-11"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-adopt11"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-adopt14"
|
||||
- "[0-9]+.[0-9]+.[0-9]+-adopt15"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -32,20 +30,68 @@ jobs:
|
||||
build:
|
||||
needs:
|
||||
- test
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build and push Docker images
|
||||
uses: docker/build-push-action@v1.1.0
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
DOCKER_IMAGE=itzg/minecraft-server
|
||||
VERSION=edge
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
fi
|
||||
if [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/heads/}
|
||||
if [[ $VERSION == master ]]; then
|
||||
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
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
repository: itzg/minecraft-server
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
tag_with_ref: true
|
||||
tag_with_sha: false
|
||||
cache_froms: itzg/minecraft-server:latest
|
||||
add_git_labels: true
|
||||
labels: org.opencontainers.image.url=https://github.com/itzg/docker-minecraft-server,org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
# ensure latest base image is used
|
||||
pull: true
|
||||
# publish
|
||||
push: true
|
||||
# tags determined by prep step
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
labels: |
|
||||
org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
|
||||
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
|
||||
org.opencontainers.image.source=https://github.com/itzg/docker-minecraft-server
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
FROM ubuntu:18.04
|
||||
FROM adoptopenjdk:15-jre
|
||||
|
||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install -y \
|
||||
openjdk-8-jre-headless \
|
||||
imagemagick \
|
||||
gosu \
|
||||
sudo \
|
||||
@@ -68,9 +67,9 @@ WORKDIR /data
|
||||
|
||||
ENV UID=1000 GID=1000 \
|
||||
MEMORY="1G" \
|
||||
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
|
||||
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||
TYPE=VANILLA VERSION=LATEST \
|
||||
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||
SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
|
||||
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0
|
||||
|
||||
|
||||
99
README.md
99
README.md
@@ -116,8 +116,24 @@ to map a directory on your host machine to the container's `/data` directory, su
|
||||
|
||||
docker run -d -v /path/on/host:/data ...
|
||||
|
||||
When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host`
|
||||
and start the server again with `docker start CONTAINERID` to pick up the new configuration.
|
||||
When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host` and start the server again with `docker start CONTAINER_ID` to pick up the new configuration.
|
||||
|
||||
As example, using Docker compose, create the following `docker-compose.yml` in its own directory and the container will automatically create/attach the relative directory `data` to the container:
|
||||
|
||||
```yaml
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
ports:
|
||||
- 25565:25565
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
volumes:
|
||||
# attach the relative directory 'data' to the container's /data path
|
||||
./data:/data
|
||||
```
|
||||
|
||||
## Versions
|
||||
|
||||
@@ -144,23 +160,31 @@ the server jar remain in the `/data` directory. It is safe to remove those._
|
||||
|
||||
To use a different version of Java, please use a docker tag to run your Minecraft server.
|
||||
|
||||
| Tag name | Description | Linux |
|
||||
| -------------- | ------------------------------------------- | ------------ |
|
||||
| latest | **Default**. Uses Java version 8 | Alpine Linux |
|
||||
| adopt15 | Uses Java version 15 from AdoptOpenJDK | Alpine Linux |
|
||||
| adopt14 | Uses Java version 14 from AdoptOpenJDK | Alpine Linux |
|
||||
| adopt13 | Uses Java version 13 from AdoptOpenJDK | Alpine Linux |
|
||||
| adopt11 | Uses Java version 11 from AdoptOpenJDK | Alpine Linux |
|
||||
| openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux |
|
||||
| openj9-nightly | Uses Eclipse OpenJ9 JVM testing builds | Alpine Linux |
|
||||
| multiarch | Uses Java version 8 latest update | Debian Linux |
|
||||
| multiarch-latest | Uses Java version 15 latest update | Debian Linux |
|
||||
| Tag name | Java version | Linux | JVM Type | Architecture |
|
||||
| -------------- | -------------|--------|----------|-------------------|
|
||||
| latest | 11 | Alpine | Hotspot | amd64 |
|
||||
| java8 | 8 | Alpine | Hotspot | amd64 |
|
||||
| java8-multiarch | 8 | Debian | Hotspot | amd64,arm64,armv7 |
|
||||
| java15 | 15 | Debian | Hotspot | amd64,arm64,armv7 |
|
||||
| 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 |
|
||||
|
||||
For example, to use a Java version 13:
|
||||
For example, to use Java version 15 on any supported architecture:
|
||||
|
||||
docker run --name mc itzg/minecraft-server:adopt13
|
||||
docker run --name mc itzg/minecraft-server:java15
|
||||
|
||||
Keep in mind that some versions of Minecraft server can't work on the newest versions of Java. Also, FORGE doesn't support openj9 JVM implementation.
|
||||
> Keep in mind that some versions of Minecraft server can't work on the newest versions of Java. Also, FORGE doesn't support openj9 JVM implementation.
|
||||
|
||||
### Deprecated Image Tags
|
||||
|
||||
The following image tags have been deprecated and are no longer receiving updates:
|
||||
- adopt13
|
||||
- adopt14
|
||||
- adopt15
|
||||
- openj9-nightly
|
||||
|
||||
## Healthcheck
|
||||
|
||||
@@ -463,6 +487,18 @@ A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of P
|
||||
|
||||
> **NOTE** only `VERSION=LATEST` is supported
|
||||
|
||||
## Running a Purpur server
|
||||
|
||||
A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper and Tuinity with the goal of providing new and interesting configuration options".
|
||||
|
||||
-e TYPE=PURPUR
|
||||
|
||||
> NOTE: the `VERSION` variable is used to lookup a build of Purpur to download
|
||||
|
||||
Extra variables:
|
||||
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
|
||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||
|
||||
## Running a Magma server
|
||||
|
||||
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
|
||||
@@ -491,7 +527,7 @@ A [Catserver](http://catserver.moe/) type server can be used with
|
||||
|
||||
## Running a server with a Feed the Beast modpack
|
||||
|
||||
> **NOTE** requires `itzg/minecraft-server:multiarch` image
|
||||
> **NOTE** requires one of the Debian based images listed in [the Java versions section](#running-minecraft-server-on-different-java-version).
|
||||
|
||||
[Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by using `-e TYPE=FTBA` (**note** the "A" at the end of the type). This server type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified.
|
||||
|
||||
@@ -752,12 +788,18 @@ To whitelist players for your Minecraft server, pass the Minecraft usernames sep
|
||||
|
||||
If the `WHITELIST` environment variable is not used, any user can join your Minecraft server if it's publicly accessible.
|
||||
|
||||
> NOTE: When `WHITELIST` is used the server property `white-list` will automatically get set to `true`.
|
||||
|
||||
> By default, the players in `WHITELIST` are **added** to the final `whitelist.json` file by the Minecraft server. If you set `OVERRIDE_WHITELIST` to "true" then the `whitelist.json` file will be recreated on each server startup.
|
||||
|
||||
### Op/Administrator Players
|
||||
|
||||
To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as
|
||||
|
||||
docker run -d -e OPS=user1,user2 ...
|
||||
|
||||
> By default, the players in `OPS` are **added** to the final `ops.json` file by the Minecraft server. If you set `OVERRIDE_OPS` to "true" then the `ops.json` file will be recreated on each server startup.
|
||||
|
||||
### Server icon
|
||||
|
||||
A server icon can be configured using the `ICON` variable. The image will be automatically
|
||||
@@ -765,6 +807,10 @@ downloaded, scaled, and converted from any other image format:
|
||||
|
||||
docker run -d -e ICON=http://..../some/image.png ...
|
||||
|
||||
The server icon which has been set doesn't get overridden by default. It can be changed and overridden by setting `OVERRIDE_ICON` to `TRUE`.
|
||||
|
||||
docker run -d -e ICON=http://..../some/other/image.png -e OVERRIDE_ICON=TRUE...
|
||||
|
||||
### Rcon
|
||||
|
||||
To use rcon use the `ENABLE_RCON` and `RCON_PASSORD` variables.
|
||||
@@ -931,7 +977,7 @@ environment variable set to `false`, such as
|
||||
### Level Type and Generator Settings
|
||||
|
||||
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, such as
|
||||
be configured by setting `LEVEL_TYPE` to an expected type, for example
|
||||
|
||||
- DEFAULT
|
||||
- FLAT
|
||||
@@ -939,6 +985,8 @@ be configured by setting `LEVEL_TYPE` to an expected type, such as
|
||||
- AMPLIFIED
|
||||
- CUSTOMIZED
|
||||
- BUFFET
|
||||
- BIOMESOP (Biomes O' Plenty for 1.12 and older)
|
||||
- BIOMESOPLENTY (Biomes O' Plenty for 1.15 and above)
|
||||
|
||||
Descriptions are available at the [gamepedia](http://minecraft.gamepedia.com/Server.properties).
|
||||
|
||||
@@ -1069,19 +1117,18 @@ is passed to `docker run`.
|
||||
|
||||
### Memory Limit
|
||||
|
||||
By default, the image declares a Java initial and maximum memory limit of 1 GB. There are several
|
||||
ways to adjust the memory settings:
|
||||
By default, the image declares an initial and maximum Java memory-heap limit of 1 GB. There are several ways to adjust the memory settings:
|
||||
|
||||
- `MEMORY`, "1G" by default, can be used to adjust both initial (`Xms`) and max (`Xmx`)
|
||||
memory settings of the JVM
|
||||
- `INIT_MEMORY`, independently sets the initial heap size
|
||||
- `MAX_MEMORY`, independently sets the max heap size
|
||||
- `MEMORY`: "1G" by default, can be used to adjust both initial (`Xms`) and max (`Xmx`) memory heap settings of the JVM
|
||||
- `INIT_MEMORY`: independently sets the initial heap size
|
||||
- `MAX_MEMORY`: independently sets the max heap size
|
||||
|
||||
The values of all three are passed directly to the JVM and support format/units as
|
||||
`<size>[g|G|m|M|k|K]`. For example:
|
||||
The values of all three are passed directly to the JVM and support format/units as `<size>[g|G|m|M|k|K]`. For example:
|
||||
|
||||
-e MEMORY=2G
|
||||
|
||||
> NOTE: the settings above only set the Java **heap** limits. Memory resource requests and limits on the overall container should also account for non-heap memory usage. An extra 25% is [a general best practice](https://dzone.com/articles/best-practices-java-memory-arguments-for-container).
|
||||
|
||||
### JVM Options
|
||||
|
||||
General JVM options can be passed to the Minecraft Server invocation by passing a `JVM_OPTS`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
# Use this variable to indicate a list of branches that docker hub is watching
|
||||
branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'adopt14' 'adopt15' 'multiarch' 'multiarch-latest')
|
||||
branches_list=('java8' 'java8-multiarch' 'openj9' 'openj9-11' 'adopt11' 'java15' 'multiarch' 'multiarch-latest')
|
||||
|
||||
function TrapExit {
|
||||
echo "Checking out back in master"
|
||||
|
||||
12
examples/docker-compose-simple.yml
Normal file
12
examples/docker-compose-simple.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
mc:
|
||||
image: itzg/minecraft-server
|
||||
ports:
|
||||
- 25565:25565
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
volumes:
|
||||
# attach the relative directory 'data' to the container's /data path
|
||||
./data:/data
|
||||
@@ -15,17 +15,35 @@ autopause_error_loop() {
|
||||
logAutopause "Autopause failed to initialize. This log entry will be printed every 30 minutes."
|
||||
while :
|
||||
do
|
||||
if [[ -n $(ps -ax -o comm | grep java) ]] ; then
|
||||
break
|
||||
fi
|
||||
sleep 0.1
|
||||
sleep 1800
|
||||
logAutopause "Autopause failed to initialize."
|
||||
done
|
||||
}
|
||||
|
||||
# wait for java process to be started
|
||||
while :
|
||||
do
|
||||
if java_process_exists ; then
|
||||
break
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
# check for interface existence
|
||||
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
|
||||
logAutopause "Selected interface \"$AUTOPAUSE_KNOCK_INTERFACE\" does not exist!"
|
||||
autopause_error_loop
|
||||
fi
|
||||
|
||||
sudo /usr/sbin/knockd -c /tmp/knockd-config.cfg -d -i "$AUTOPAUSE_KNOCK_INTERFACE"
|
||||
if [ $? -ne 0 ] ; then
|
||||
logAutopause "Failed to start knockd daemon."
|
||||
logAutopause "Possible cause: docker's host network mode."
|
||||
logAutopause "Recreate without host mode or disable autopause functionality."
|
||||
logAutopause "Stopping server."
|
||||
pkill -SIGTERM java
|
||||
exit 1
|
||||
logAutopause "Probable cause: Unable to attach to interface \"$AUTOPAUSE_KNOCK_INTERFACE\"."
|
||||
autopause_error_loop
|
||||
fi
|
||||
|
||||
STATE=INIT
|
||||
|
||||
@@ -9,7 +9,7 @@ java_running() {
|
||||
}
|
||||
|
||||
java_process_exists() {
|
||||
[[ -n "$(ps -a -o comm | grep 'java')" ]]
|
||||
[[ -n "$(ps -ax -o comm | grep 'java')" ]]
|
||||
}
|
||||
|
||||
rcon_client_exists() {
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
|
||||
: ${PROXY:=}
|
||||
: ${RCON_PASSWORD_FILE:=}
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
#umask 002
|
||||
@@ -88,6 +93,10 @@ case "${TYPE^^}" in
|
||||
;;
|
||||
|
||||
FORGE)
|
||||
log "**********************************************************************"
|
||||
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
|
||||
log " since some mods require Java 8"
|
||||
log "**********************************************************************"
|
||||
exec ${SCRIPTS:-/}start-deployForge "$@"
|
||||
;;
|
||||
|
||||
@@ -131,10 +140,14 @@ case "${TYPE^^}" in
|
||||
exec ${SCRIPTS:-/}start-deployCatserver "$@"
|
||||
;;
|
||||
|
||||
PURPUR)
|
||||
exec ${SCRIPTS:-/}start-deployPurpur "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
log "Invalid type: '$TYPE'"
|
||||
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
||||
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA,"
|
||||
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR"
|
||||
log " CUSTOM, MAGMA, MOHIST, CATSERVER"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
|
||||
export TYPE=FORGE
|
||||
: ${FORGEVERSION:=RECOMMENDED}
|
||||
|
||||
if [[ -z $FORGE_INSTALLER && -z $FORGE_INSTALLER_URL ]]; then
|
||||
norm=$VANILLA_VERSION
|
||||
|
||||
@@ -58,7 +58,7 @@ else
|
||||
|
||||
log "Removing old PaperMC versions ..."
|
||||
paperJarSearchString=${SERVER/$build/[0-9]*}
|
||||
find . -name "$paperJarSearchString" ! -name "$SERVER" -delete -print
|
||||
find . -maxdepth 1 -name "$paperJarSearchString" ! -name "$SERVER" -delete -print
|
||||
|
||||
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
|
||||
curl -fsSL -o "$SERVER" "${zarg[@]}" \
|
||||
|
||||
38
start-deployPurpur
Executable file
38
start-deployPurpur
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
isDebugging && set -x
|
||||
|
||||
: ${VANILLA_VERSION:?}
|
||||
: ${PURPUR_BUILD:=LATEST}
|
||||
: ${FORCE_REDOWNLOAD:=false}
|
||||
|
||||
if [[ ${PURPUR_BUILD} == LATEST ]]; then
|
||||
PURPUR_BUILD=$(curl -fsSL "https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}" |
|
||||
jq -r '.builds.latest' || echo "")
|
||||
if [[ -z ${PURPUR_BUILD} ]]; then
|
||||
log "ERROR: Failed to locate a Purpur build for ${VANILLA_VERSION}."
|
||||
log " Please check if a download is available at https://purpur.pl3x.net/downloads/"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
|
||||
export SERVER="purpur-${VANILLA_VERSION}-${PURPUR_BUILD}.jar"
|
||||
|
||||
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
||||
downloadUrl="https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}/${PURPUR_BUILD}/download"
|
||||
log "Downloading Purpur from $downloadUrl ..."
|
||||
if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then
|
||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
|
||||
# Normalize on Spigot for later operations
|
||||
export TYPE=SPIGOT
|
||||
export SKIP_LOG4J_CONFIG=true
|
||||
|
||||
# Continue to Final Setup
|
||||
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||
@@ -3,6 +3,8 @@
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
|
||||
export TYPE=spongevanilla
|
||||
: ${SPONGEBRANCH:=STABLE}
|
||||
: ${SPONGEVERSION:=}
|
||||
|
||||
# Parse branch
|
||||
log "Choosing branch for Sponge"
|
||||
|
||||
@@ -20,7 +20,7 @@ if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Normalize on Spigot for operations below
|
||||
# Normalize on Spigot for later operations
|
||||
export TYPE=SPIGOT
|
||||
|
||||
# Continue to Final Setup
|
||||
|
||||
@@ -81,16 +81,23 @@ if [[ "$MODS" ]]; then
|
||||
do
|
||||
if isURL $i; then
|
||||
log "Downloading mod/plugin $i ..."
|
||||
effective_url=$(resolveEffectiveUrl "$i")
|
||||
if isValidFileURL jar "${effective_url}"; then
|
||||
out_file=$(getFilenameFromUrl "${effective_url}")
|
||||
if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then
|
||||
if isValidFileURL jar "$i"; then
|
||||
if ! curl -fsSL -o "${out_dir}/$(getFilenameFromUrl "${i}")" "${i}"; then
|
||||
log "ERROR: failed to download from $i into $out_dir"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
log "ERROR: $effective_url resolved from $i is not a valid jar URL"
|
||||
exit 2
|
||||
effective_url=$(resolveEffectiveUrl "$i")
|
||||
if isValidFileURL jar "${effective_url}"; then
|
||||
out_file=$(getFilenameFromUrl "${effective_url}")
|
||||
if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then
|
||||
log "ERROR: failed to download from $i into $out_dir"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
log "ERROR: $effective_url resolved from $i is not a valid jar URL"
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log "ERROR Invalid URL given in MODS: $i"
|
||||
|
||||
@@ -69,7 +69,7 @@ function customizeServerProps {
|
||||
setServerProp "max-world-size" "$MAX_WORLD_SIZE"
|
||||
setServerProp "level-name" "$LEVEL"
|
||||
setServerProp "level-seed" "$SEED"
|
||||
setServerProp "pvp" "$PVP"
|
||||
setServerProp "pvp" "${PVP}"
|
||||
setServerProp "generator-settings" "$GENERATOR_SETTINGS"
|
||||
setServerProp "online-mode" "$ONLINE_MODE"
|
||||
setServerProp "allow-flight" "$ALLOW_FLIGHT"
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
set -e
|
||||
isDebugging && set -x
|
||||
|
||||
: ${LEVEL:=world}
|
||||
export LEVEL
|
||||
|
||||
if [ $TYPE = "FEED-THE-BEAST" ]; then
|
||||
worldDest=$FTB_DIR/$LEVEL
|
||||
else
|
||||
|
||||
@@ -3,28 +3,40 @@
|
||||
. ${SCRIPTS:-/}start-utils
|
||||
|
||||
if [ -n "$OPS" ]; then
|
||||
log "Setting/adding ops"
|
||||
rm -rf /data/ops.txt.converted
|
||||
log "Updating ops"
|
||||
rm -f /data/ops.txt.converted
|
||||
echo $OPS | awk -v RS=, '{print}' > /data/ops.txt
|
||||
|
||||
if isTrue "${OVERRIDE_OPS}"; then
|
||||
log "Recreating ops.json file at server startup"
|
||||
rm -f /data/ops.json
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$WHITELIST" ]; then
|
||||
log "Setting whitelist"
|
||||
rm -rf /data/white-list.txt.converted
|
||||
log "Updating whitelist"
|
||||
rm -f /data/white-list.txt.converted
|
||||
echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt
|
||||
|
||||
if isTrue "${OVERRIDE_WHITELIST}"; then
|
||||
log "Recreating whitelist.json file at server startup"
|
||||
rm -f /data/whitelist.json
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
||||
log "Using server icon from $ICON..."
|
||||
# Not sure what it is yet...call it "img"
|
||||
curl -sSL -o /tmp/icon.img $ICON
|
||||
specs=$(identify /tmp/icon.img | awk '{print $2,$3}')
|
||||
if [ "$specs" = "PNG 64x64" ]; then
|
||||
mv /tmp/icon.img /data/server-icon.png
|
||||
else
|
||||
log "Converting image to 64x64 PNG..."
|
||||
convert /tmp/icon.img -resize 64x64! /data/server-icon.png
|
||||
fi
|
||||
if [ -n "$ICON" ]; then
|
||||
if [ ! -e server-icon.png ] || [ "${OVERRIDE_ICON}" == "TRUE" ]; then
|
||||
log "Using server icon from $ICON..."
|
||||
# Not sure what it is yet...call it "img"
|
||||
curl -sSL -o /tmp/icon.img $ICON
|
||||
specs=$(identify /tmp/icon.img | awk '{print $2,$3}')
|
||||
if [ "$specs" = "PNG 64x64" ]; then
|
||||
mv /tmp/icon.img /data/server-icon.png
|
||||
else
|
||||
log "Converting image to 64x64 PNG..."
|
||||
convert /tmp/icon.img -resize 64x64! /data/server-icon.png
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! isTrue ${SKIP_LOG4J_CONFIG}; then
|
||||
|
||||
@@ -145,7 +145,8 @@ requireVar() {
|
||||
}
|
||||
|
||||
function writeEula() {
|
||||
if ! echo "# Generated via Docker on $(date)
|
||||
if ! echo "# Generated via Docker
|
||||
# $(date)
|
||||
eula=${EULA,,}
|
||||
" >/data/eula.txt; then
|
||||
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
||||
|
||||
Reference in New Issue
Block a user