Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
dont change ownership of mounted volume
Browse files Browse the repository at this point in the history
  • Loading branch information
brchri committed Oct 8, 2023
1 parent b3ec237 commit 8e6acbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN apk add --no-cache bash tzdata su-exec && \
adduser --uid $USER_UID --ingroup nonroot --system --shell bin/bash nonroot && \
chown -R nonroot:nonroot /app

COPY --from=builder --chown=nonroot:nonroot --chmod=755 /app/tesla-youq /app/config.example.yml /app/
COPY --from=builder --chown=nonroot:nonroot --chmod=777 /app/tesla-youq /app/config.example.yml /app/
COPY --chmod=755 ./entrypoint.sh /app/

ENV PATH="/app:${PATH}"
Expand Down
7 changes: 6 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ if [ -n "$PUID" ] && [ "$PUID" -ne 0 ] && [ "$PUID" -ne "$OUID" ]; then
RUID=$PGID
fi

chown $RUID:$RGID /app /app/*
# change ownership of all files and folders in /app EXCEPT config, which is a mounted volume
chown $RUID:$RGID /app
for file in /app/*; do
[ "$(basename "$file")" = "config" ] && continue
chown $RUID:$RGID $file
done

# Use su-exec to execute the command as nonroot user
exec su-exec $RUID:$RGID "$@"

0 comments on commit 8e6acbc

Please sign in to comment.