mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-04-09 23:28:51 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5a4428515 | ||
|
|
6b9033318b | ||
|
|
9ee907783d | ||
|
|
463cc62b75 | ||
|
|
5afd98edd8 | ||
|
|
8b9051d72e | ||
|
|
d6392f3aa9 | ||
|
|
fe808be91b | ||
|
|
2cab10e906 | ||
|
|
7f39d1f22e | ||
|
|
a9184368c1 | ||
|
|
caf2fc2ab6 | ||
|
|
5dd8141e5e | ||
|
|
2ff28675d4 | ||
|
|
519bd986b5 | ||
|
|
e41efba176 |
@@ -4,12 +4,18 @@ LABEL maintainer "itzg"
|
|||||||
|
|
||||||
RUN apk -U add bash
|
RUN apk -U add bash
|
||||||
|
|
||||||
ENV ES_VERSION=5.4.3
|
ARG ES_VERSION=5.5.1
|
||||||
|
# avoid conflicts with debian host systems when mounting to host volume
|
||||||
|
ARG DEFAULT_ES_USER_UID=1100
|
||||||
|
|
||||||
ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp/es.tgz
|
ADD https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz /tmp
|
||||||
|
# need to adapt to both Docker's new remote-unpack-ADD behavior and the old behavior
|
||||||
RUN cd /usr/share && \
|
RUN cd /usr/share && \
|
||||||
tar xf /tmp/es.tgz && \
|
if [ -f /tmp/elasticsearch-$ES_VERSION.tar.gz ]; then \
|
||||||
rm /tmp/es.tgz
|
tar xf /tmp/elasticsearch-$ES_VERSION.tar.gz; \
|
||||||
|
else mv /tmp/elasticsearch-${ES_VERSION} /usr/share; \
|
||||||
|
fi && \
|
||||||
|
rm -f /tmp/elasticsearch-$ES_VERSION.tar.gz
|
||||||
|
|
||||||
EXPOSE 9200 9300
|
EXPOSE 9200 9300
|
||||||
|
|
||||||
@@ -17,9 +23,10 @@ HEALTHCHECK --timeout=5s CMD wget -q -O - http://$HOSTNAME:9200/_cat/health
|
|||||||
|
|
||||||
ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \
|
ENV ES_HOME=/usr/share/elasticsearch-$ES_VERSION \
|
||||||
DEFAULT_ES_USER=elasticsearch \
|
DEFAULT_ES_USER=elasticsearch \
|
||||||
|
DEFAULT_ES_USER_UID=$DEFAULT_ES_USER_UID \
|
||||||
ES_JAVA_OPTS="-Xms1g -Xmx1g"
|
ES_JAVA_OPTS="-Xms1g -Xmx1g"
|
||||||
|
|
||||||
RUN adduser -S -s /bin/sh $DEFAULT_ES_USER
|
RUN adduser -S -s /bin/sh -u $DEFAULT_ES_USER_UID $DEFAULT_ES_USER
|
||||||
|
|
||||||
VOLUME ["/data","/conf"]
|
VOLUME ["/data","/conf"]
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ services:
|
|||||||
UNICAST_HOSTS: master
|
UNICAST_HOSTS: master
|
||||||
MIN_MASTERS: 1
|
MIN_MASTERS: 1
|
||||||
ES_JAVA_OPTS: -Xms756m -Xmx756m
|
ES_JAVA_OPTS: -Xms756m -Xmx756m
|
||||||
|
TYPE: NON_DATA
|
||||||
ports:
|
ports:
|
||||||
- "9200:9200"
|
- "9200:9200"
|
||||||
- "9300:9300"
|
- "9300:9300"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ services:
|
|||||||
TYPE: INGEST
|
TYPE: INGEST
|
||||||
UNICAST_HOSTS: master
|
UNICAST_HOSTS: master
|
||||||
kibana:
|
kibana:
|
||||||
image: kibana
|
image: kibana:5.5.1
|
||||||
ports:
|
ports:
|
||||||
- "5601:5601"
|
- "5601:5601"
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ RUN apk add -U \
|
|||||||
lsof \
|
lsof \
|
||||||
su-exec \
|
su-exec \
|
||||||
bash \
|
bash \
|
||||||
curl \
|
curl iputils wget \
|
||||||
git \
|
git \
|
||||||
jq \
|
jq \
|
||||||
mysql-client \
|
mysql-client \
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
||||||
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
||||||
|
[](https://github.com/itzg/dockerfiles/issues)
|
||||||
|
|
||||||
This docker image provides a Minecraft Server that will automatically download the latest stable
|
This docker image provides a Minecraft Server that will automatically download the latest stable
|
||||||
version at startup. You can also run/upgrade to any specific version or the
|
version at startup. You can also run/upgrade to any specific version or the
|
||||||
@@ -683,7 +684,7 @@ To use this option pass the environment variable `REMOVE_OLD_MODS="TRUE"`, such
|
|||||||
|
|
||||||
**NOTE:** This option will be taken into account only when option `MODPACK` is also used.
|
**NOTE:** This option will be taken into account only when option `MODPACK` is also used.
|
||||||
|
|
||||||
**WARNING:** All content of the `mods` or `plugins` directory will be deleted
|
**WARNING:** All content of the `mods` or `plugins` directory will be deleted
|
||||||
before unpacking new content from the zip file.
|
before unpacking new content from the zip file.
|
||||||
|
|
||||||
### Online mode
|
### Online mode
|
||||||
@@ -710,3 +711,9 @@ The values of all three are passed directly to the JVM and support format/units
|
|||||||
### /data ownership
|
### /data ownership
|
||||||
|
|
||||||
In order to adapt to differences in `UID` and `GID` settings the entry script will attempt to correct ownership and writability of the `/data` directory. This logic can be disabled by setting `-e SKIP_OWNERSHIP_FIX=TRUE`.
|
In order to adapt to differences in `UID` and `GID` settings the entry script will attempt to correct ownership and writability of the `/data` directory. This logic can be disabled by setting `-e SKIP_OWNERSHIP_FIX=TRUE`.
|
||||||
|
|
||||||
|
### JVM Options
|
||||||
|
|
||||||
|
General JVM options can be passed to the Minecraft Server invocation by passing a `JVM_OPTS`
|
||||||
|
environment variable. Options like `-X` that need to proceed general JVM options can be passed
|
||||||
|
via a `JVM_XX_OPTS` environment variable.
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
#umask 002
|
#umask 002
|
||||||
export HOME=/data
|
export HOME=/data
|
||||||
|
|
||||||
@@ -7,6 +9,10 @@ if [ ! -e /data/eula.txt ]; then
|
|||||||
if [ "$EULA" != "" ]; then
|
if [ "$EULA" != "" ]; then
|
||||||
echo "# Generated via Docker on $(date)" > eula.txt
|
echo "# Generated via Docker on $(date)" > eula.txt
|
||||||
echo "eula=$EULA" >> eula.txt
|
echo "eula=$EULA" >> eula.txt
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
echo "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
echo "Please accept the Minecraft EULA at"
|
echo "Please accept the Minecraft EULA at"
|
||||||
@@ -18,6 +24,11 @@ if [ ! -e /data/eula.txt ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! touch /data/.verify_access; then
|
||||||
|
echo "ERROR: /data doesn't seem to be writable. Please make sure attached directory is writable by uid=${UID} "
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
SERVER_PROPERTIES=/data/server.properties
|
SERVER_PROPERTIES=/data/server.properties
|
||||||
FTB_DIR=/data/FeedTheBeast
|
FTB_DIR=/data/FeedTheBeast
|
||||||
VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
||||||
@@ -259,16 +270,18 @@ function installFTB {
|
|||||||
local srv_modpack=${FTB_SERVER_MOD}
|
local srv_modpack=${FTB_SERVER_MOD}
|
||||||
if isURL ${srv_modpack}; then
|
if isURL ${srv_modpack}; then
|
||||||
case $srv_modpack in
|
case $srv_modpack in
|
||||||
*/download)
|
https://www.feed-the-beast.com/*/download)
|
||||||
break;;
|
break;;
|
||||||
*)
|
https://www.feed-the-beast.com/*)
|
||||||
srv_modpack=${srv_modpack}/download;;
|
srv_modpack=${srv_modpack}/download;;
|
||||||
esac
|
esac
|
||||||
local file=$(basename $(dirname $srv_modpack))
|
local file=$(basename $(dirname $srv_modpack))
|
||||||
local downloaded=/data/${file}.zip
|
local downloaded=/data/${file}.zip
|
||||||
echo "Downloading FTB modpack...
|
if [ ! -e $downloaded ]; then
|
||||||
|
echo "Downloading FTB modpack...
|
||||||
$srv_modpack -> $downloaded"
|
$srv_modpack -> $downloaded"
|
||||||
curl -sSL -o $downloaded $srv_modpack
|
curl -sSL -o $downloaded $srv_modpack
|
||||||
|
fi
|
||||||
srv_modpack=$downloaded
|
srv_modpack=$downloaded
|
||||||
fi
|
fi
|
||||||
if [[ ${srv_modpack:0:5} == "data/" ]]; then
|
if [[ ${srv_modpack:0:5} == "data/" ]]; then
|
||||||
@@ -289,10 +302,12 @@ function installFTB {
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Unpacking FTB server modpack ${srv_modpack} ..."
|
if [ ! -d ${FTB_DIR} ]; then
|
||||||
mkdir -p ${FTB_DIR}
|
echo "Unpacking FTB server modpack ${srv_modpack} ..."
|
||||||
unzip -o ${srv_modpack} -d ${FTB_DIR}
|
mkdir -p ${FTB_DIR}
|
||||||
cp -f /data/eula.txt ${FTB_DIR}/eula.txt
|
unzip -o ${srv_modpack} -d ${FTB_DIR}
|
||||||
|
cp -f /data/eula.txt ${FTB_DIR}/eula.txt
|
||||||
|
fi
|
||||||
FTB_SERVER_START=${FTB_DIR}/ServerStart.sh
|
FTB_SERVER_START=${FTB_DIR}/ServerStart.sh
|
||||||
chmod a+x ${FTB_SERVER_START}
|
chmod a+x ${FTB_SERVER_START}
|
||||||
sed -i "s/-jar/-Dfml.queryResult=confirm -jar/" ${FTB_SERVER_START}
|
sed -i "s/-jar/-Dfml.queryResult=confirm -jar/" ${FTB_SERVER_START}
|
||||||
@@ -423,6 +438,28 @@ case "X$MODPACK" in
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If supplied with a URL for a config (simple zip of configurations), download it and unpack
|
||||||
|
if [[ "$MODCONFIG" ]]; then
|
||||||
|
case "X$MODCONFIG" in
|
||||||
|
X[Hh][Tt][Tt][Pp]*[Zz][iI][pP])
|
||||||
|
echo "Downloading mod/plugin configs via HTTP"
|
||||||
|
echo " from $MODCONFIG ..."
|
||||||
|
curl -sSL -o /tmp/modconfig.zip "$MODCONFIG"
|
||||||
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
|
mkdir -p /data/plugins
|
||||||
|
unzip -o -d /data/plugins /tmp/modconfig.zip
|
||||||
|
else
|
||||||
|
mkdir -p /data/config
|
||||||
|
unzip -o -d /data/config /tmp/modconfig.zip
|
||||||
|
fi
|
||||||
|
rm -f /tmp/modconfig.zip
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid URL given for modconfig: Must be HTTP or HTTPS and a ZIP file"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
function setServerProp {
|
function setServerProp {
|
||||||
local prop=$1
|
local prop=$1
|
||||||
local var=$2
|
local var=$2
|
||||||
@@ -561,12 +598,12 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
|
||||||
if [[ ! -e banned-players.json || ! $(jq banned-players.json &> /dev/null) ]]; then
|
for j in *.json; do
|
||||||
echo '[]' > banned-players.json
|
if [[ $(python -c "print open('$j').read().strip()==''") = True ]]; then
|
||||||
fi
|
echo "Fixing JSON $j"
|
||||||
if [[ ! -e banned-ips.json || ! $(jq banned-ips.json &> /dev/null) ]]; then
|
echo '[]' > $j
|
||||||
echo '[]' > banned-ips.json
|
fi
|
||||||
fi
|
done
|
||||||
|
|
||||||
# If any modules have been provided, copy them over
|
# If any modules have been provided, copy them over
|
||||||
mkdir -p /data/mods
|
mkdir -p /data/mods
|
||||||
@@ -613,7 +650,7 @@ if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
|||||||
cp -f /data/{eula,ops,white-list}.txt ${FTB_DIR}/
|
cp -f /data/{eula,ops,white-list}.txt ${FTB_DIR}/
|
||||||
cd ${FTB_DIR}
|
cd ${FTB_DIR}
|
||||||
echo "Running FTB server modpack start ..."
|
echo "Running FTB server modpack start ..."
|
||||||
exec sh ${FTB_SERVER_START}
|
exec ${FTB_SERVER_START}
|
||||||
else
|
else
|
||||||
# If we have a bootstrap.txt file... feed that in to the server stdin
|
# If we have a bootstrap.txt file... feed that in to the server stdin
|
||||||
if [ -f /data/bootstrap.txt ];
|
if [ -f /data/bootstrap.txt ];
|
||||||
|
|||||||
Reference in New Issue
Block a user