If the script is run as root (as in a Docker environment), allow an optional user to run non-system wide commands. So if run in Docker as root, we need to have
root $ useradd -m notroot # create a user
root $ apt install dep0 dep1 dep2 # install system-wide dependencies
then as the user nonroot,
notroot $ cpanm -L /path/to/author # install deps
notroot $ # do the rest of the build
notroot $ prove -lvr t/
This means that we also need to chown nonroot /build so that the nonroot user can write in it.
This is necessary for code that we test that can not be run as root, (e.g., sandboxed Chrome which requires --no-sandbox to run under a root user). This split is a good idea in general.
If the script is run as root (as in a Docker environment), allow an optional user to run non-system wide commands. So if run in Docker as root, we need to have
then as the user
nonroot
,This means that we also need to
chown nonroot /build
so that thenonroot
user can write in it.This is necessary for code that we test that can not be run as root, (e.g., sandboxed Chrome which requires
--no-sandbox
to run under a root user). This split is a good idea in general.