rake-compiler / rake-compiler-dock

Easy to use and reliable cross compiler environment for building Windows, Linux, Mac and JRuby binary gems.
MIT License
77 stars 30 forks source link

make OCI container images easier to use within containerd-based CI systems #41

Closed flavorjones closed 2 years ago

flavorjones commented 3 years ago

The workflow documented in the README and elsewhere relies on having a host system in which the user runs rake-compiler-dock (or some variation like RakeCompilerDock.sh) which runs through RakeCompilerDock::Starter.exec. Specifically, there is an assumption being made that the user is logging in to the container via the runas script and setting all the necessary environment variables to make it work (e.g., GID, GROUP, UID, USER).

My current use case, which I think is not unique, is that I have a CI system which I provide an OCI image and a script to run. I want to use the rake-compiler-dock images to test building a native gem, but unfortunately I can't easily invoke runas because I don't want or need to create a container-local user and group.

To work around this, I'm keeping my my script in sync with runas, currently it contains:

  . /etc/rubybashrc
  ln -s /usr/local/rake-compiler "$HOME"/.rake-compiler

and now for 1.1.0 to operate correctly I need to add

  export RAKE_EXTENSION_TASK_NO_NATIVE=true

My mental model is that runas is conflating two separate concepts:

  1. creating a container-local user and group so that file permissions aren't janky
  2. setting up the user environment to build correctly

I'd like to propose separating these two concepts.

If you're open to this kind of a change, I'd be happy to work on a PR that would:

An alternative approach might be to have runas conditionally create the user and group only if those (or other) environment variables are set.

Thoughts?

larskanis commented 2 years ago

This is solved in #57 .