mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-18 15:36:22 +00:00
Compare commits
7 Commits
2021.16.0-
...
2021.15.0-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5877f6208 | ||
|
|
d561c026c6 | ||
|
|
3cd3ca9d88 | ||
|
|
b9ef9a46b6 | ||
|
|
275863f04c | ||
|
|
ae94a6be3a | ||
|
|
d08c6e2c46 |
2
.github/workflows/build-multiarch.yml
vendored
2
.github/workflows/build-multiarch.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
|||||||
docker-buildx:
|
docker-buildx:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
env:
|
env:
|
||||||
CACHE_NAME: master
|
CACHE_NAME: java16
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v2.3.4
|
||||||
|
|||||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
- test
|
- test
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
env:
|
env:
|
||||||
CACHE_NAME: master
|
CACHE_NAME: java16
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.3.4
|
- uses: actions/checkout@v2.3.4
|
||||||
|
|||||||
@@ -70,5 +70,5 @@ The multiarch images are built and published by [a Github action](https://github
|
|||||||
The following git command can be used to provide the bulk of release notes content:
|
The following git command can be used to provide the bulk of release notes content:
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --grep "^build(deps)" --pretty="- %s" 1.1.0..1.2.0
|
git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --pretty="- %s" 1.1.0..1.2.0
|
||||||
```
|
```
|
||||||
|
|||||||
39
Dockerfile
39
Dockerfile
@@ -1,29 +1,29 @@
|
|||||||
FROM openjdk:8u212-jre-alpine
|
FROM adoptopenjdk:16-jre
|
||||||
|
|
||||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||||
|
|
||||||
RUN apk add --no-cache -U \
|
RUN apt-get update \
|
||||||
openssl \
|
&& DEBIAN_FRONTEND=noninteractive \
|
||||||
|
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 -g 1000 minecraft \
|
RUN addgroup --gid 1000 minecraft \
|
||||||
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
&& adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data 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=linux
|
ARG TARGETOS
|
||||||
ARG TARGETARCH=amd64
|
ARG TARGETARCH
|
||||||
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 \
|
||||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
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,5 +84,6 @@ 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
|
||||||
|
|||||||
@@ -145,7 +145,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: Wed Jun 9 12:35:18 UTC 2021 -->
|
<!-- Added by: runner, at: Sun May 23 17:29:02 UTC 2021 -->
|
||||||
|
|
||||||
<!--te-->
|
<!--te-->
|
||||||
|
|
||||||
@@ -452,13 +452,15 @@ An [Airplane](https://github.com/TECHNOVE/Airplane) server, which is a fork of T
|
|||||||
|
|
||||||
> **NOTE** only `VERSION=LATEST` is supported
|
> **NOTE** only `VERSION=LATEST` is supported
|
||||||
|
|
||||||
|
> **NOTE** only Java 8 and 11 are supported
|
||||||
|
|
||||||
Extra variables:
|
Extra variables:
|
||||||
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
||||||
|
|
||||||
### Running a Purpur server
|
### Running a Purpur server
|
||||||
|
|
||||||
A [Purpur](https://purpur.pl3x.net/) server, which is "a drop-in replacement for Paper servers designed for configurability, new fun and exciting gameplay features, and high performance built on top of Tuinity.".
|
A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper, Tuinity, Airplane with the goal of providing new and interesting configuration options".
|
||||||
|
|
||||||
-e TYPE=PURPUR
|
-e TYPE=PURPUR
|
||||||
|
|
||||||
@@ -467,6 +469,7 @@ A [Purpur](https://purpur.pl3x.net/) server, which is "a drop-in replacement for
|
|||||||
Extra variables:
|
Extra variables:
|
||||||
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
|
- `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
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
|
- `USE_FLARE_FLAGS=false` : set to true to add appropriate flags for the [Flare](https://blog.airplane.gg/flare) profiler
|
||||||
|
|
||||||
### Running a Yatopia server
|
### Running a Yatopia server
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ current_uptime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java_running() {
|
java_running() {
|
||||||
[[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]]
|
[[ $( ps -ax -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
java_process_exists() {
|
java_process_exists() {
|
||||||
[[ -n "$(ps -a -o comm | grep 'java')" ]]
|
[[ -n "$(ps -ax -o comm | grep 'java')" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
rcon_client_exists() {
|
rcon_client_exists() {
|
||||||
[[ -n "$(ps -a -o comm | grep 'rcon-cli')" ]]
|
[[ -n "$(ps -ax -o comm | grep 'rcon-cli')" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
mc_server_listening() {
|
mc_server_listening() {
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
[unpauseMCServer-server]
|
[unpauseMCServer-server]
|
||||||
sequence = 25565
|
sequence = 25565
|
||||||
seq_timeout = 1
|
seq_timeout = 1
|
||||||
command = /sbin/su-exec minecraft:minecraft /autopause/resume.sh
|
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
|
||||||
tcpflags = syn
|
tcpflags = syn
|
||||||
[unpauseMCServer-rcon]
|
[unpauseMCServer-rcon]
|
||||||
sequence = 25575
|
sequence = 25575
|
||||||
seq_timeout = 1
|
seq_timeout = 1
|
||||||
command = /sbin/su-exec minecraft:minecraft /autopause/resume.sh
|
command = /usr/sbin/gosu minecraft:minecraft /autopause/resume.sh
|
||||||
tcpflags = syn
|
tcpflags = syn
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. /start-utils
|
. /start-utils
|
||||||
|
|
||||||
if [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^S.*$ ]] ; then
|
if [[ $( ps -ax -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
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. /start-utils
|
. /start-utils
|
||||||
|
|
||||||
if [[ $( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }') =~ ^T.*$ ]] ; then
|
if [[ $( ps -ax -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
|
||||||
|
|||||||
2
start
2
start
@@ -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 su-exec ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
||||||
else
|
else
|
||||||
exec ${SCRIPTS:-/}start-configuration $@
|
exec ${SCRIPTS:-/}start-configuration $@
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -56,7 +56,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}:/usr/bin"
|
PATH="${PATH}:/opt/java/openjdk/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,6 +98,12 @@ 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 "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -105,7 +111,17 @@ 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 "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ isDebugging && set -x
|
|||||||
|
|
||||||
JAVA_VER=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
|
JAVA_VER=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
|
||||||
|
|
||||||
if [ "${JAVA_VER}" = "8" ]; then
|
if [ "${JAVA_VER}" != "8" ] && [ "${JAVA_VER}" != "11" ]; then
|
||||||
JDK=8
|
log "ERROR: Airplane server type only supports Java versions 8 and 11"
|
||||||
else
|
exit 1
|
||||||
JDK=11
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${VERSION}" != "LATEST" ]; then
|
if [ "${VERSION}" != "LATEST" ]; then
|
||||||
@@ -18,10 +17,10 @@ if [ "${VERSION}" != "LATEST" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SERVER=airplane-${VANILLA_VERSION}-jdk${JDK}.jar
|
export SERVER=airplane-${VANILLA_VERSION}-jdk${JAVA_VER}.jar
|
||||||
|
|
||||||
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
||||||
downloadUrl="https://dl.airplane.gg/latest/Airplane-JDK${JDK}/launcher-airplane.jar"
|
downloadUrl="https://dl.airplane.gg/latest/Airplane-JDK${JAVA_VER}/launcher-airplane.jar"
|
||||||
log "Downloading Airplane from $downloadUrl ..."
|
log "Downloading Airplane from $downloadUrl ..."
|
||||||
curl -fsSL -o "$SERVER" "$downloadUrl"
|
curl -fsSL -o "$SERVER" "$downloadUrl"
|
||||||
if [ ! -f "$SERVER" ]; then
|
if [ ! -f "$SERVER" ]; then
|
||||||
|
|||||||
@@ -52,14 +52,12 @@ fi
|
|||||||
|
|
||||||
isDebugging && cat version.json
|
isDebugging && cat version.json
|
||||||
forgeVersion=$(jq -r '.targets|unique[] | select(.name == "forge") | .version' version.json)
|
forgeVersion=$(jq -r '.targets|unique[] | select(.name == "forge") | .version' version.json)
|
||||||
fabricVersion=$(jq -r '.targets|unique[] | select(.name == "fabric") | .version' version.json)
|
|
||||||
mcVersion=$(jq -r '.targets|unique[] | select(.name == "minecraft") | .version' version.json)
|
mcVersion=$(jq -r '.targets|unique[] | select(.name == "minecraft") | .version' version.json)
|
||||||
|
|
||||||
variants=(
|
variants=(
|
||||||
forge-${mcVersion}-${forgeVersion}.jar
|
forge-${mcVersion}-${forgeVersion}.jar
|
||||||
forge-${mcVersion}-${forgeVersion}-universal.jar
|
forge-${mcVersion}-${forgeVersion}-universal.jar
|
||||||
forge-${mcVersion}-${forgeVersion}-${mcVersion}-universal.jar
|
forge-${mcVersion}-${forgeVersion}-${mcVersion}-universal.jar
|
||||||
fabric-${mcVersion}-${fabricVersion}-server-launch.jar
|
|
||||||
)
|
)
|
||||||
for f in ${variants[@]}; do
|
for f in ${variants[@]}; do
|
||||||
if [ -f $f ]; then
|
if [ -f $f ]; then
|
||||||
@@ -68,7 +66,7 @@ for f in ${variants[@]}; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if ! [ -v SERVER ]; then
|
if ! [ -v SERVER ]; then
|
||||||
log "ERROR unable to locate the installed FTB server jar"
|
log "ERROR unable to locate the installed forge server jar"
|
||||||
ls *.jar
|
ls *.jar
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ IFS=$'\n\t'
|
|||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
: ${VANILLA_VERSION:?}
|
: ${VANILLA_VERSION:?}
|
||||||
: ${RELEASE:=latest}
|
: ${RELEASE:=stable}
|
||||||
: ${FORCE_REDOWNLOAD:=false}
|
: ${FORCE_REDOWNLOAD:=false}
|
||||||
|
|
||||||
requireEnum RELEASE stable latest
|
requireEnum RELEASE stable latest
|
||||||
|
|||||||
@@ -17,5 +17,4 @@ services:
|
|||||||
- itzg/minecraft-server:latest
|
- itzg/minecraft-server:latest
|
||||||
environment:
|
environment:
|
||||||
EULA: "TRUE"
|
EULA: "TRUE"
|
||||||
VERSION: "1.16.5"
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user