Commit Graph

26 Commits

Author SHA1 Message Date
David M. Lary f3fc294a08 manylinux: add builder group to own python files
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
2026-01-21 15:58:45 -06:00
Matt McCormick 63e91f59aa common: install rustup into /opt/rustup
To avoid long-running chown's per https://github.com/dockcross/dockcross/issues/901
2025-10-09 08:17:27 -04:00
Jean-Christophe Fillion-Robin f48bb9b136 fix(entrypoint.sh): Avoid error if rustup is not installed
Only move `/root/.rustup` and `/root/.cargo` directories if they exist.
This prevents errors when re-using the script in environments where
Rust is not installed (e.g. https://github.com/dockbuild/dockbuild).

Previously, `mv` would fail if either directory was missing:

```
mv: cannot stat '/root/.rustup': No such file or directory
mv: cannot stat '/root/.cargo': No such file or directory
```
2025-07-22 13:23:18 -04:00
Nicolas Boichat 52604c0b66 entrypoint.sh: Silence errors if /dev/pts/0 does not exist 2025-07-02 11:41:08 +08:00
Matt McCormick 3deaae3929 Merge pull request #891 from maxiaogood/maxiao_fix_dev_pts
fix /dev/pts/0 permissions
2025-06-10 22:35:40 -04:00
maxiao dcb6bde44b Change ownership of /dev/pts/0 to new user 2025-05-30 23:17:25 +08:00
maxiao 0ca299216e fix /dev/pts/0 permissions 2025-05-30 23:06:00 +08:00
Nicolas Boichat 27e0cf6c78 imagefiles/entrypoint.sh: Move rust/cargo directories
Presumably we do not need those as root.
2025-05-28 15:31:51 +02:00
Nicolas Boichat 494c154b87 imagefiles/entrypoint.sh: Remove sync call
This slows down the container startup for what appears to be no
good reason.

This workaround was added in 2016:
dd9d902538 ,
see also https://github.com/moby/moby/issues/13594#issuecomment-262441366 ,
and hopefully AUFS has been fixed by now.
2025-05-28 14:41:52 +02:00
Bensuperpc d59411d2cb Fix bash scripts
Fix bash scripts

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
2021-08-08 20:45:36 +02:00
Bensuperpc 8f19ce75f0 Fix wrong file name in entrypoint dockcross -> dockcross.sh
Fix wrong file name in entrypoint dockcross -> dockcross.sh

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
2021-08-04 11:17:08 +02:00
Daniel Hwang b3e72f7bf4 allow .dockcross to use sudo
so set-up sudo before .dockcross executes!
2020-05-25 20:55:47 -07:00
Matt McCormick ba72994b41 common: Fix bash shell script invocation
`#!/usr/bin/env bash` should be used to avoid hard paths.

To address:

  dockcross-manylinux-x64: bad interpreter: /bin/bash^M: no such file or directory
2018-08-20 18:12:32 -04:00
Jean-Christophe Fillion-Robin 7b76882b56 entrypoint.sh: Account for image tag when updating help text
This commit is a follow up of b7028af (entrypoint.sh: Update help
text so that current image name is used)

It ensures that the suggested script in the help text doesn't include ":"
in its name.

Assuming DEFAULT_DOCKCROSS_IMAGE is set to "dockcross/imagename:latest"

Instead of suggesting:

  [...]
  # docker run --rm dockcross/imagename:latest > dockcross-imagename:latest
  # chmod +x dockcross-imagename:latest
  [...]

it will now suggest

  [...]
  # docker run --rm dockcross/imagename:latest > dockcross-imagename-latest
  # chmod +x dockcross-imagename-latest
  [...]

xref https://github.com/dockbuild/dockbuild/issues/30

[ci skip]
2018-03-29 21:04:52 -04:00
Jean-Christophe Fillion-Robin b7028af76e entrypoint.sh: Update help text so that current image name is used
xref https://github.com/dockbuild/dockbuild/issues/30
2018-03-29 04:43:26 -04:00
Constantine Grantcharov b1cef063a1 Fix $HOME directory ownership permissions
BUG:

Creating a new directory under /home/<user>/ from the /work folder does
not work. In fact, going into the home directory and trying to run mkdir
fails as well.

SOLUTION:

Turns out chown -R <user>:<user> was run on $HOME/* instead of on $HOME.
This means that /home/<user> was still under the ownership of root:root,
hence preventing any writes to non-root users.
2017-06-29 08:31:33 -04:00
Jean-Christophe Fillion-Robin dd9d902538 Fix "text file busy" error reported when using AUFS storage driver
This commit fixes the following error specific to AUFS:

/dockcross/entrypoint.sh: line 47: /usr/bin/gosu: Text file busy
/dockcross/entrypoint.sh: line 47: /usr/bin/gosu: Success

Thanks @sobolevn
See https://github.com/moby/moby/issues/13594#issuecomment-262441366
2017-05-01 16:35:28 -04:00
Matt McCormick 4c3612da2b common: Use gosu to replace chpst and add sudo abilities
From:

  https://github.com/tianon/gosu
2017-04-22 23:35:12 -04:00
Jean-Christophe Fillion-Robin 4ad3e1a94f dockcross: Add support for per-project configuration 2016-11-26 21:47:11 -05:00
Matt McCormick 6b71b08cbd doc: We support Docker for Mac and Docker for Windows
No longer support boot2docker on these platforms
2016-11-16 19:08:04 -08:00
Jean-Christophe Fillion-Robin 8923c6a3c7 manylinux.common: Fix warning changing ownership of python install
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.
2016-11-04 22:58:31 -04:00
Jean-Christophe Fillion-Robin 995c9091e5 manylinux: Grant current user password less sudo access.
This will allow build script like "build-wheels.sh" to run command like
the following (see [1]):

  sudo yum install -y atlas-devel

It will also allow to pip install using sudo and avoid error reported in [3].

That said, instead of running pip using sudo, the recommended approach
is to specify the "--user" flag [2]

[1] https://github.com/pypa/python-manylinux-demo/blob/893d92517e9e289b9d2ee063f19c3216a39534ab/travis/build-wheels.sh

[2] http://stackoverflow.com/questions/7143077/how-can-i-install-packages-in-my-home-folder-with-pip#7143496

[3] Error reported when running pip without "sudo pip install <packagename" or "pip install --user <packagename>"
```
Exception:
Traceback (most recent call last):
  File "/opt/_internal/cpython-2.7.11-ucs2/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/opt/_internal/cpython-2.7.11-ucs2/lib/python2.7/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/opt/_internal/cpython-2.7.11-ucs2/lib/python2.7/site-packages/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/opt/_internal/cpython-2.7.11-ucs2/lib/python2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/opt/_internal/cpython-2.7.11-ucs2/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/opt/_internal/cpython-2.7.11-ucs2/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/opt/_internal/cpython-2.7.11-ucs2/lib/python2.7/shutil.py", line 303, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/opt/_internal/cpython-2.7.11-ucs2/bin/easy_install'
```
2016-09-22 19:21:24 -04:00
Matt McCormick 30e29f3bbb browser-asmjs: cp ~/.emscripten, etc to the user home in the entrypoint 2016-07-06 15:33:35 -04:00
Matt McCormick 3a96030b23 base: support BUILDER_USER, BUILDER_GROUP, and liquidprompt bash 2016-07-04 22:03:10 -04:00
Matt McCormick fdb18671e3 dockcross: make the default image specific to each compiler 2016-07-04 00:10:36 -04:00
Sven Fischer 8e344a9537 Added functionality to ease the use of X image
Functionality borrowed from the Raspberry Pi cross compile docker build
file from https://github.com/sdt/docker-raspberry-pi-cross-compiler
2016-05-30 22:50:22 +02:00