PUID and PGID Environment Variable Support and some changes changes to VCS functions #77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature: Dynamic PUID/PGID & Robust VCS Stability
This PR introduces essential functionality for managing user privileges and significantly enhances the reliability of fetching configuration via Git, addressing common failure points related to secrets and shell execution.
1. Security & Dynamic PUID/PGID Support
The container now runs the application as a non-root user that dynamically matches the host's User ID (PUID) and Group ID (PGID). These environment variables are optional and will default to 1001 if not provided. This enhances security and ensures correct file ownership.
entrypoint.sh
(New)exec su
to safely drop privileges before running the application.root
after setup.Dockerfile
shadow
package.2. Robust VCS Integration
The core application script, now named
run-imapfilter.sh
(renamed from the original entrypoint), continues to execute as a low-privilege user and was hardened to make Git authentication with Personal Access Tokens (PATs) more reliable.vcs_token()
tr -d '[:space:]'
to token retrieval.vcs_uri()
case
statement (${GIT_TARGET#*://}
).https://...https://
).pull_config()
git pull --ff-only
command withgit -C <path>
and added the--verbose
flag.cd
/cd -
) and simplifies complex update logic into a single, reliable step while making error output visible in the logs for quick troubleshooting.--verbose
and2>&1
).