mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
parent
f7523eef4e
commit
76d4fd1bbc
@ -19,7 +19,8 @@ RUN useradd -s /bin/false --uid 1000 minecraft \
|
||||
&& mkdir /config \
|
||||
&& mkdir /mods \
|
||||
&& mkdir /plugins \
|
||||
&& chown minecraft:minecraft /data /config /mods /plugins
|
||||
&& mkdir /home/minecraft \
|
||||
&& chown minecraft:minecraft /data /config /mods /plugins /home/minecraft
|
||||
|
||||
EXPOSE 25565 25575
|
||||
|
||||
|
@ -4,16 +4,17 @@ set -e
|
||||
usermod --uid $UID minecraft
|
||||
groupmod --gid $GID minecraft
|
||||
|
||||
chown -R minecraft:minecraft /data /start-minecraft /home/minecraft
|
||||
chmod -R g+wX /data /start-minecraft
|
||||
fix_ownership() {
|
||||
dir=$1
|
||||
if ! sudo -u minecraft test -w $dir; then
|
||||
echo "Correcting writability of $dir ..."
|
||||
chown -R minecraft:minecraft $dir
|
||||
chmod -R u+w $dir
|
||||
fi
|
||||
}
|
||||
|
||||
while lsof -- /start-minecraft; do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
mkdir -p /home/minecraft
|
||||
chown minecraft: /home/minecraft
|
||||
fix_ownership /data
|
||||
fix_ownership /home/minecraft
|
||||
|
||||
echo "Switching to user 'minecraft'"
|
||||
exec sudo -E -u minecraft /start-minecraft "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user