mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-17 05:54:55 +00:00
@@ -7,6 +7,7 @@ RUN apk add --no-cache -U \
|
|||||||
imagemagick \
|
imagemagick \
|
||||||
lsof \
|
lsof \
|
||||||
su-exec \
|
su-exec \
|
||||||
|
shadow \
|
||||||
bash \
|
bash \
|
||||||
curl iputils wget \
|
curl iputils wget \
|
||||||
git \
|
git \
|
||||||
@@ -57,5 +58,3 @@ ENV JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
|||||||
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true
|
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true
|
||||||
|
|
||||||
COPY start* /
|
COPY start* /
|
||||||
|
|
||||||
USER minecraft
|
|
||||||
|
|||||||
@@ -733,6 +733,13 @@ Allows users to use flight on your server while in Survival mode, if they have a
|
|||||||
|
|
||||||
## Miscellaneous Options
|
## Miscellaneous Options
|
||||||
|
|
||||||
|
### Running as alternate user/group ID
|
||||||
|
|
||||||
|
By default, the container will switch to user ID 1000 and group ID 1000;
|
||||||
|
however, you can override those values by setting `UID` and `GID`, respectively.
|
||||||
|
The container will also skip user switching if the `--user`/`-u` argument
|
||||||
|
is passed to `docker run`.
|
||||||
|
|
||||||
### Memory Limit
|
### Memory Limit
|
||||||
|
|
||||||
By default, the image declares a Java initial and maximum memory limit of 1 GB. There are several
|
By default, the image declares a Java initial and maximum memory limit of 1 GB. There are several
|
||||||
|
|||||||
+9
-94
@@ -1,98 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
shopt -s nullglob
|
if [ $(id -u) = 0 ]; then
|
||||||
|
if [[ -v UID ]]; then
|
||||||
#umask 002
|
usermod -u $UID minecraft
|
||||||
export HOME=/data
|
|
||||||
|
|
||||||
if [ ! -e /data/eula.txt ]; then
|
|
||||||
if [ "$EULA" != "" ]; then
|
|
||||||
echo "# Generated via Docker on $(date)" > 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
|
|
||||||
echo ""
|
|
||||||
echo "Please accept the Minecraft EULA at"
|
|
||||||
echo " https://account.mojang.com/documents/minecraft_eula"
|
|
||||||
echo "by adding the following immediately after 'docker run':"
|
|
||||||
echo " -e EULA=TRUE"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
if [[ -v GID ]]; then
|
||||||
|
groupmod -g $GID minecraft
|
||||||
|
fi
|
||||||
|
su-exec minecraft:minecraft /start-configuration
|
||||||
|
else
|
||||||
|
exec /start-configuration
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running as '$(id -u):$(id -g)' with /data as '$(ls -lnd /data)'"
|
|
||||||
|
|
||||||
if ! touch /data/.verify_access; then
|
|
||||||
echo "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
|
|
||||||
export http_proxy="$PROXY"
|
|
||||||
export https_proxy="$PROXY"
|
|
||||||
echo "INFO: Giving proxy time to startup..."
|
|
||||||
sleep 5
|
|
||||||
fi
|
|
||||||
|
|
||||||
export SERVER_PROPERTIES=/data/server.properties
|
|
||||||
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
|
||||||
|
|
||||||
echo "Checking version information."
|
|
||||||
case "X$VERSION" in
|
|
||||||
X|XLATEST|Xlatest)
|
|
||||||
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.release'`
|
|
||||||
;;
|
|
||||||
XSNAPSHOT|Xsnapshot)
|
|
||||||
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.snapshot'`
|
|
||||||
;;
|
|
||||||
X[1-9]*)
|
|
||||||
export VANILLA_VERSION=$VERSION
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.release'`
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
cd /data
|
|
||||||
|
|
||||||
export ORIGINAL_TYPE=${TYPE}
|
|
||||||
|
|
||||||
echo "Checking type information."
|
|
||||||
case "$TYPE" in
|
|
||||||
*BUKKIT|*bukkit|SPIGOT|spigot)
|
|
||||||
exec /start-deployBukkitSpigot $@
|
|
||||||
;;
|
|
||||||
|
|
||||||
PAPER|paper)
|
|
||||||
exec /start-deployPaper $@
|
|
||||||
;;
|
|
||||||
|
|
||||||
FORGE|forge)
|
|
||||||
exec /start-deployForge $@
|
|
||||||
;;
|
|
||||||
|
|
||||||
FTB|ftb)
|
|
||||||
exec /start-deployFTB $@
|
|
||||||
;;
|
|
||||||
|
|
||||||
VANILLA|vanilla)
|
|
||||||
exec /start-deployVanilla $@
|
|
||||||
;;
|
|
||||||
|
|
||||||
SPONGEVANILLA|spongevanilla)
|
|
||||||
exec /start-deploySpongeVanilla $@
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "Invalid type: '$TYPE'"
|
|
||||||
echo "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, SPONGEVANILLA"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|||||||
Executable
+98
@@ -0,0 +1,98 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
#umask 002
|
||||||
|
export HOME=/data
|
||||||
|
|
||||||
|
if [ ! -e /data/eula.txt ]; then
|
||||||
|
if [ "$EULA" != "" ]; then
|
||||||
|
echo "# Generated via Docker on $(date)" > 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
|
||||||
|
echo ""
|
||||||
|
echo "Please accept the Minecraft EULA at"
|
||||||
|
echo " https://account.mojang.com/documents/minecraft_eula"
|
||||||
|
echo "by adding the following immediately after 'docker run':"
|
||||||
|
echo " -e EULA=TRUE"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running as '$(id -u):$(id -g)' with /data as '$(ls -lnd /data)'"
|
||||||
|
|
||||||
|
if ! touch /data/.verify_access; then
|
||||||
|
echo "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
|
||||||
|
export http_proxy="$PROXY"
|
||||||
|
export https_proxy="$PROXY"
|
||||||
|
echo "INFO: Giving proxy time to startup..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SERVER_PROPERTIES=/data/server.properties
|
||||||
|
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
||||||
|
|
||||||
|
echo "Checking version information."
|
||||||
|
case "X$VERSION" in
|
||||||
|
X|XLATEST|Xlatest)
|
||||||
|
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.release'`
|
||||||
|
;;
|
||||||
|
XSNAPSHOT|Xsnapshot)
|
||||||
|
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.snapshot'`
|
||||||
|
;;
|
||||||
|
X[1-9]*)
|
||||||
|
export VANILLA_VERSION=$VERSION
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
export VANILLA_VERSION=`curl -fsSL $VERSIONS_JSON | jq -r '.latest.release'`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
cd /data
|
||||||
|
|
||||||
|
export ORIGINAL_TYPE=${TYPE}
|
||||||
|
|
||||||
|
echo "Checking type information."
|
||||||
|
case "$TYPE" in
|
||||||
|
*BUKKIT|*bukkit|SPIGOT|spigot)
|
||||||
|
exec /start-deployBukkitSpigot $@
|
||||||
|
;;
|
||||||
|
|
||||||
|
PAPER|paper)
|
||||||
|
exec /start-deployPaper $@
|
||||||
|
;;
|
||||||
|
|
||||||
|
FORGE|forge)
|
||||||
|
exec /start-deployForge $@
|
||||||
|
;;
|
||||||
|
|
||||||
|
FTB|ftb)
|
||||||
|
exec /start-deployFTB $@
|
||||||
|
;;
|
||||||
|
|
||||||
|
VANILLA|vanilla)
|
||||||
|
exec /start-deployVanilla $@
|
||||||
|
;;
|
||||||
|
|
||||||
|
SPONGEVANILLA|spongevanilla)
|
||||||
|
exec /start-deploySpongeVanilla $@
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Invalid type: '$TYPE'"
|
||||||
|
echo "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, SPONGEVANILLA"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user