diff --git a/Dockerfile b/Dockerfile index 8789272..4556f98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,8 @@ ENV RENDER_POI "true" ENV RENDER_SIGNS_FILTER "-- RENDER --" ENV RENDER_SIGNS_HIDE_FILTER "false" ENV RENDER_SIGNS_JOINER "
" +ENV UID 1000 +ENV GID 1000 # ---------------------------- # # INSTALL & CONFIGURE DEFAULTS # @@ -72,6 +74,4 @@ COPY download_url.py /home/minecraft/download_url.py RUN chown minecraft:minecraft -R /home/minecraft/ -USER minecraft - CMD ["bash", "/home/minecraft/entrypoint.sh"] diff --git a/README.md b/README.md index f263838..d0d9a5d 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,9 @@ _Note:_ The `latest` Docker tag is rebuilt daily. If there are changes to the [u - `RENDER_SIGNS_JOINER` Default Value: `
`. Set to the string that should be used to join the lines on the sign while rendering. Value of `"
"` will make each in-game line it's own line on the render. A value of `" "` will make all the in-game lines a single line on the render. + +- `UID` + Default Value: 1000. Set to the UID of the user the container process should run as. + +- `GID` + Default Value: 1000. Set to the GID of the user the container process should run as. diff --git a/entrypoint.sh b/entrypoint.sh index 1ac800d..869c880 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,16 @@ #!/bin/bash +if [ $(id -u) = 0 ]; then + echo "UID: ${UID}" + usermod -u ${UID} minecraft > /dev/null 2>&1 + echo "GID: ${GID}" + groupmod -g ${GID} minecraft > /dev/null 2>&1 + echo "Updating permissions..." + chown -R minecraft:minecraft /home/minecraft/render + echo "Done." + echo "Starting Overviewer." + su -c "bash $0" minecraft +else + set -o errexit # Require MINECRAFT_VERSION environment variable to be set (no default assumed) @@ -43,3 +55,5 @@ if [ "$RENDER_POI" == "true" ]; then # shellcheck disable=SC2086 overviewer.py --config "$CONFIG_LOCATION" --genpoi $ADDITIONAL_ARGS_POI fi + +fi \ No newline at end of file