From 95a9d24b76a7596afc6e456a65febf1f53a53249 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 13 Feb 2020 01:10:36 +0100 Subject: [PATCH] Run with same UID as datadir owner This should fix problems with owner/uid mismatch when an existing prosody data directory is mounted into the container Closes #39 --- Dockerfile | 1 - entrypoint.sh | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3b5a970..d8896b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,6 +51,5 @@ RUN chmod 755 /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] EXPOSE 80 443 5222 5269 5347 5280 5281 -USER prosody ENV __FLUSH_LOG yes CMD ["prosody", "-F"] diff --git a/entrypoint.sh b/entrypoint.sh index d018fa6..76f0bb1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +usermod -u "$(stat -c %u /var/lib/prosody/.)" prosody + if [[ "$1" != "prosody" ]]; then exec prosodyctl "$@" exit 0; @@ -10,4 +12,4 @@ if [ "$LOCAL" -a "$PASSWORD" -a "$DOMAIN" ] ; then prosodyctl register "$LOCAL" "$DOMAIN" "$PASSWORD" fi -exec "$@" +runuser -u prosody -- "$@"