From 0bacad024545f6aa15b40b0363704cfdb036bcfb Mon Sep 17 00:00:00 2001 From: Zedifus Date: Sun, 27 Feb 2022 20:55:31 +0000 Subject: [PATCH] Apply file perms from env in entrypoint --- Dockerfile | 1 - docker_launcher.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 07d1a4b2..302310e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,4 +51,3 @@ EXPOSE 25500-25600 USER crafty ENTRYPOINT ["/commander/docker_launcher.sh"] CMD ["-v", "-d", "-i"] - diff --git a/docker_launcher.sh b/docker_launcher.sh index 3eed33b8..7af8edbd 100644 --- a/docker_launcher.sh +++ b/docker_launcher.sh @@ -6,6 +6,15 @@ if [ ! "$(ls -A ./app/config)" ]; then cp -r ./app/config_original/* ./app/config/ fi +# Set user/group permissions to env or default to image root +groupmod -g "${PGID}" -o crafty +sed -i -E "s/^(crafty:x):[0-9]+:[0-9]+:(.*)/\\1:$PUID:$PGID:\\2/" /etc/passwd + +# Apply new permissions taken from env over working dirs +chown -R crafty:crafty \ + /commander/ \ + /commander-venv/ + # Activate our prepared venv and launch crafty with provided args . /commander-venv/bin/activate exec python3 main.py $@