The manylinux images can take over a minute to start on spinning disks
(not SSDs) because pre_exec.sh is changing the ownership of all the
python install directories to be writable by the BUILDER_UID. This is
detailed further in #853.
I changed the build steps for manylinux images to add a group called
`builder`, then change the python directories to be owned by the
`builder` group, and group writable. I then changed pre_exec.sh to add
BUILDER_USER to the builder group prior to the gosu switch to become
BUILDER_USER. The result is that BUILDER_USER is in the `builder`
group that can write to the python directories, allowing the user to
install python packages without permission denied errors.
There was one additional change to support this, and that was the
arguments to `gosu` in entrypoint.sh. Previously the arguments were
`$BUILDER_UID:BUILDER_GID`, but providing the gid prevents `gosu` from
loading additional groups (such as `builder`) from /etc/group. I
removed the GID argument to allow `gosu` to pick up additional groups
from /etc/group.
fixes#853
This commit will fix installation of packages like nose that would otherwise
fail to install with error like the following:
Installing collected packages: nose
Exception:
Traceback (most recent call last):
[...]
Permission denied: '/opt/_internal/cpython-2.7.11-ucs2/man'
While the use of sudo (made possible by 53cf084) allows to install
additional packages, the warning copied below was still reported.
To avoid this warning and streamline the installation of new packages,
this commit (1) introduces the concept of "pre_exec" entrypoint hook
and (2) adds such a hook to change the ownership of python "bin" and
"site-packages" directories for the manylinux images.
Warning reported are similar to this one:
```
The directory '/home/jcfr/.cache/pip/http' or its parent directory is
not owned by the current user and the cache has been disabled. Please
check the permissions and owner of that directory. If executing pip
with sudo, you may want sudo's -H flag.
```
Note that the sudo "-H" flag suggested in the warning is not available
in centos.