diff --git a/Dockerfile b/Dockerfile index 28365d2..e39ae5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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}" diff --git a/entrypoint.sh b/entrypoint.sh index bfc60f3..e82a147 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 "$@"