From 142d708ee3ca90601254785332f9cf4b98c2e896 Mon Sep 17 00:00:00 2001 From: Beau Harrison Date: Thu, 17 Nov 2022 08:16:24 +1000 Subject: [PATCH] Fixed long docker startup time by optimizing chown use --- Dockerfile | 1 + backend/entrypoint.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e8be307..a539b0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,6 +61,7 @@ COPY --chown=$UID:$GID --from=ffmpeg [ "/usr/local/bin/ffmpeg", "/usr/local/bin/ COPY --chown=$UID:$GID --from=ffmpeg [ "/usr/local/bin/ffprobe", "/usr/local/bin/ffprobe" ] COPY --chown=$UID:$GID --from=backend ["/app/","/app/"] COPY --chown=$UID:$GID --from=frontend [ "/build/backend/public/", "/app/public/" ] +RUN chown $UID:$GID . RUN chmod +x /app/fix-scripts/*.sh # Add some persistence data #VOLUME ["/app/appdata"] diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh index 8be147f..ed568e7 100755 --- a/backend/entrypoint.sh +++ b/backend/entrypoint.sh @@ -10,7 +10,7 @@ fi # chown current working directory to current user if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then - find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' + || echo "WARNING! Could not change directory ownership. If you manage permissions externally this is fine, otherwise you may experience issues when downloading or deleting videos." + find . \! -user "$UID" -exec chown "$UID:$GID" '{}' + || echo "WARNING! Could not change directory ownership. If you manage permissions externally this is fine, otherwise you may experience issues when downloading or deleting videos." exec gosu "$UID:$GID" "$0" "$@" fi