mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-10-18 09:18:11 +00:00
Auto-merging via docker-versions-create
This commit is contained in:
commit
5d3393d66b
6 files changed
+101
-16
No files matched your search
@@ -29,8 +29,6 @@ RUN addgroup -g 1000 minecraft \
|
|||||||
|
|
||||||
EXPOSE 25565 25575
|
EXPOSE 25565 25575
|
||||||
|
|
||||||
RUN echo 'hosts: files dns' > /etc/nsswitch.conf
|
|
||||||
|
|
||||||
ARG ARCH=amd64
|
ARG ARCH=amd64
|
||||||
|
|
||||||
ARG EASY_ADD_VER=0.3.0
|
ARG EASY_ADD_VER=0.3.0
|
||||||
|
|||||||
@@ -2,7 +2,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/docker-minecraft-server/issues)
|
[](https://github.com/itzg/docker-minecraft-server/issues)
|
||||||
[](https://gitter.im/itzg/dockerfiles)
|
[](https://discord.gg/DXfKpjB)
|
||||||
[](https://www.buymeacoffee.com/itzg)
|
[](https://www.buymeacoffee.com/itzg)
|
||||||
|
|
||||||
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
|
||||||
@@ -106,9 +106,9 @@ and start the server again with `docker start CONTAINERID` to pick up the new co
|
|||||||
|
|
||||||
To use a different Minecraft version, pass the `VERSION` environment variable, which can have the value
|
To use a different Minecraft version, pass the `VERSION` environment variable, which can have the value
|
||||||
|
|
||||||
* LATEST
|
* LATEST (the default)
|
||||||
* SNAPSHOT
|
* SNAPSHOT
|
||||||
* (or a specific version, such as "1.7.9")
|
* or a specific version, such as "1.7.9"
|
||||||
|
|
||||||
For example, to use the latest snapshot:
|
For example, to use the latest snapshot:
|
||||||
|
|
||||||
@@ -118,6 +118,11 @@ or a specific version:
|
|||||||
|
|
||||||
docker run -d -e VERSION=1.7.9 ...
|
docker run -d -e VERSION=1.7.9 ...
|
||||||
|
|
||||||
|
When using "LATEST" or "SNAPSHOT" an upgrade can be performed by simply restarting the container.
|
||||||
|
During the next startup, if a newer version is available from the respective release channel, then
|
||||||
|
the new server jar file is downloaded and used. _NOTE: over time you might see older versions of
|
||||||
|
the server jar remain in the `/data` directory. It is safe to remove those._
|
||||||
|
|
||||||
## Healthcheck
|
## Healthcheck
|
||||||
|
|
||||||
This image contains [Dinnerbone's mcstatus](https://github.com/Dinnerbone/mcstatus) and uses
|
This image contains [Dinnerbone's mcstatus](https://github.com/Dinnerbone/mcstatus) and uses
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: example
|
||||||
|
name: example
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
serviceName: example
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: example
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: example
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: mc
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
env:
|
||||||
|
- name: EULA
|
||||||
|
value: "TRUE"
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /data
|
||||||
|
name: data
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
service: example
|
||||||
|
name: example
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 25565
|
||||||
|
targetPort: 25565
|
||||||
|
selector:
|
||||||
|
app: example
|
||||||
|
type: LoadBalancer
|
||||||
@@ -4,19 +4,41 @@ umask 0002
|
|||||||
chmod g+w /data
|
chmod g+w /data
|
||||||
|
|
||||||
if [ $(id -u) = 0 ]; then
|
if [ $(id -u) = 0 ]; then
|
||||||
if [[ -v UID && $UID != $(id -u) ]]; then
|
runAsUser=minecraft
|
||||||
usermod -u $UID minecraft
|
runAsGroup=minecraft
|
||||||
|
|
||||||
|
if [[ -v UID ]]; then
|
||||||
|
if [[ $UID != 0 ]]; then
|
||||||
|
if [[ $UID != $(id -u minecraft) ]]; then
|
||||||
|
echo "Changing uid of minecraft to $UID"
|
||||||
|
usermod -u $UID minecraft
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
runAsUser=root
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -v GID ]]; then
|
if [[ -v GID ]]; then
|
||||||
groupmod -o -g $GID minecraft
|
if [[ $GID != 0 ]]; then
|
||||||
|
if [[ $GID != $(id -g minecraft) ]]; then
|
||||||
|
echo "Changing gid of minecraft to $GID"
|
||||||
|
groupmod -o -g $GID minecraft
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
runAsGroup=root
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(stat -c "%u" /data) != $UID ]]; then
|
if [[ $(stat -c "%u" /data) != $UID ]]; then
|
||||||
echo "Changing ownership of /data to $UID ..."
|
echo "Changing ownership of /data to $UID ..."
|
||||||
chown -R minecraft:minecraft /data
|
chown -R ${runAsUser}:${runAsGroup} /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec minecraft:minecraft /start-configuration $@
|
if [[ ${SKIP_NSSWITCH_CONF^^} != TRUE ]]; then
|
||||||
|
echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec su-exec ${runAsUser}:${runAsGroup} /start-configuration $@
|
||||||
else
|
else
|
||||||
exec /start-configuration $@
|
exec /start-configuration $@
|
||||||
fi
|
fi
|
||||||
@@ -78,10 +78,20 @@ done
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$MANIFEST" ]]; then
|
if [[ "$MANIFEST" ]]; then
|
||||||
EFFECTIVE_MANIFEST_URL=$(curl -Ls -o /dev/null -w %{url_effective} $MANIFEST)
|
if [[ -e "$MANIFEST" ]]; then
|
||||||
case "X$EFFECTIVE_MANIFEST_URL" in
|
EFFECTIVE_MANIFEST_FILE=$MANIFEST
|
||||||
|
elif isURL "$MANIFEST"; then
|
||||||
|
EFFECTIVE_MANIFEST_FILE=/tmp/manifest.json
|
||||||
|
EFFECTIVE_MANIFEST_URL=$(curl -Ls -o /dev/null -w %{url_effective} $MANIFEST)
|
||||||
|
curl -Ls -o $EFFECTIVE_MANIFEST_FILE "$EFFECTIVE_MANIFEST_URL"
|
||||||
|
else
|
||||||
|
echo "MANIFEST='$MANIFEST' is not a valid manifest url or location"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "X$EFFECTIVE_MANIFEST_FILE" in
|
||||||
X*.json)
|
X*.json)
|
||||||
if [ -f "${EFFECTIVE_MANIFEST_URL}" ]; then
|
if [ -f "${EFFECTIVE_MANIFEST_FILE}" ]; then
|
||||||
MOD_DIR=${FTB_BASE_DIR:-/data}/mods
|
MOD_DIR=${FTB_BASE_DIR:-/data}/mods
|
||||||
if [ ! -d "$MOD_DIR" ]
|
if [ ! -d "$MOD_DIR" ]
|
||||||
then
|
then
|
||||||
@@ -89,7 +99,7 @@ case "X$EFFECTIVE_MANIFEST_URL" in
|
|||||||
mkdir -p "$MOD_DIR"
|
mkdir -p "$MOD_DIR"
|
||||||
fi
|
fi
|
||||||
echo "Starting manifest download..."
|
echo "Starting manifest download..."
|
||||||
cat "${EFFECTIVE_MANIFEST_URL}" | jq -r '.files[] | (.projectID|tostring) + " " + (.fileID|tostring)'| while read -r p f
|
cat "${EFFECTIVE_MANIFEST_FILE}" | jq -r '.files[] | (.projectID|tostring) + " " + (.fileID|tostring)'| while read -r p f
|
||||||
do
|
do
|
||||||
if [ ! -f $MOD_DIR/${p}_${f}.jar ]
|
if [ ! -f $MOD_DIR/${p}_${f}.jar ]
|
||||||
then
|
then
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@
|
|||||||
function isURL {
|
function isURL {
|
||||||
local value=$1
|
local value=$1
|
||||||
|
|
||||||
if [[ ${value:0:8} == "https://" || ${value:0:7} = "http://" ]]; then
|
if [[ ${value:0:8} == "https://" || ${value:0:7} == "http://" ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
@@ -39,4 +39,4 @@ function debug {
|
|||||||
if isDebugging; then
|
if isDebugging; then
|
||||||
echo "DEBUG: $*"
|
echo "DEBUG: $*"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user