Skip to content

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

Open
@ianfixes

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions