reactioncommerce / docker-base

Apache License 2.0
4 stars 11 forks source link

fix: Never usermod to uid 0 in entrypoint.sh #18

Closed focusaurus closed 4 years ago

focusaurus commented 4 years ago

The only actual change is falling back to uid 1000 if stat finds uid 0 on the mounted filesystem.

# change the app user's uid:gid to match the repo root directory's
uid=$(stat -c "%u" .)
if [[ "${uid}" == "0" ]]; then
  # Never run as root even if directory is owned by root.
  # Fall back to 1000 which we know is the app user
  uid=1000
fi
run_user="node"
usermod --uid "${uid}" --non-unique "${run_user}" |& grep -v "no changes" || true