Rails Engine Builds On Top Of Docker Randomly Failling

Hello everyone,

I’m facing an issue at the company I’m working as we migrate our build to a Docker based environment. Everything seems to be pretty fine, except that builds suddenly fail, even green builds if rebuilt can occasionally fail, and not even in the tests, it’s while bundling the gems inside the container.

Some errors usually include messages like this:

Bundler::GemspecError: Could not read gem at /box/cache/ffi-1.9.14.gem. It may be corrupted.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

We’ve already tried rebuilding without cache (which in most cases work, but no 100%), wiping out all container data between builds and avoiding the use of caching by rebuilding 'em every time from scratch and some other minor tweaks.

On local environment everything works fine all the time.
And, if it’s of any help: we use a docker-compose file to manage our multi-container structure plus our gems are being held at an busy-box container linked to the main ruby app container.

Anyone has got any thoughts on that?

Thanks in advance,
Diego Dillenburg Bueno