Skip to content

Commit

Permalink
Merge pull request #1181 from gliderlabs/readonly-container
Browse files Browse the repository at this point in the history
fix: do not unnecessarily create/change files when starting a process
  • Loading branch information
josegonzalez authored Apr 1, 2024
2 parents 6c4388c + 4fed80e commit bc6c5a9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions include/procfile.bash
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,14 @@ procfile-load-profile() {
# shellcheck disable=SC1090
source "$file"
done
mkdir -p "$app_path/.profile.d"
# shellcheck disable=SC2154
chown "$unprivileged_user:$unprivileged_group" "$app_path/.profile.d"
for file in "$app_path/.profile.d"/*.sh; do
# shellcheck disable=SC1090
source "$file"
done
if [[ -d "$app_path/.profile.d" ]]; then
# shellcheck disable=SC2154
chown "$unprivileged_user:$unprivileged_group" "$app_path/.profile.d"
for file in "$app_path/.profile.d"/*.sh; do
# shellcheck disable=SC1090
source "$file"
done
fi
if [[ -s "$app_path/.profile" ]]; then
# shellcheck disable=SC1090
source "$app_path/.profile"
Expand All @@ -122,8 +123,8 @@ procfile-setup-home() {
# shellcheck disable=SC2154
usermod --home "$app_path" "$unprivileged_user" >/dev/null 2>&1
# shellcheck disable=SC2154
chown "$unprivileged_user:$unprivileged_group" "$app_path"
if [[ "$HEROKUISH_DISABLE_CHOWN" == "true" ]]; then
chown "$unprivileged_user:$unprivileged_group" "$app_path"
# unprivileged_user & unprivileged_group are defined in outer scope
# shellcheck disable=SC2154
find "$app_path" \( \! -user "$unprivileged_user" -o \! -group "$unprivileged_group" \) -print0 | xargs -0 -r chown "$unprivileged_user:$unprivileged_group"
Expand Down

0 comments on commit bc6c5a9

Please sign in to comment.