Build a docker container with a relative path to another directory

OK. We’ve all been there. We want to make one container that installs something from git that it is in another repo. But we don’t want to keep pushing that other repo.

Perhaps you want to do something like:

ADD ../other
RUN pip install ...

But, you get this cowardly failure: “Forbidden path outside the build context”. You search and find some idea about bind mount! But… its too smart for you now and still disallows.

Sure, you could copy the repo into the current directory, but why? Lets look at a Simple way to solve this.

  1. in the .git dir of the foreign repo, run git update-server-fino
  2. run python -m SimpleHTTPServer 8000
  3. use git+ for the URL in e.g. pip install
  4. Profit!

Now you can co-develop these two things in peace.

peace out.






Leave a Reply

Your email address will not be published. Required fields are marked *