gemstash icon indicating copy to clipboard operation
gemstash copied to clipboard

For your consideration: serving local gems to enable Docker builds that refer to local changes

Open ianfixes opened this issue 4 years ago • 0 comments

Based on the rubygems.org guide on running your own gem server I was able to solve a problem that I had been having:

In local development, I can specify local gems as dependencies in my Gemfile by using the path: '../path/to/gem' option. But if I want to test that in a Docker container, I run into the limitation that docker build will fail -- Docker can't include files from outside its build context

This creates an uncomfortable choice: temporarily rewrite all the Dockerfile logic to change the docker context to my entire development directory -- very poor performance -- or fully publish all my beta gem versions after every edit.

My idea was to leverage gemstash as a local server, and wrap it in some logic that could watch my gem directories for changes -- automatically handling the build/publish to the local server. This allows the Gemfile to refer to that local server address, such that Docker builds can access them.

That code is at ianfixes/local-gemstasher, on DockerHub as ianfixes/local_gemstasher. Details in the README on how to set up the server and the Gemfile.

Was there a better way to do this sort of thing that I failed to consider? If not, I can recommend a few small changes to the server that would streamline this effort.

ianfixes avatar Mar 05 '21 16:03 ianfixes