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.
- in the .git dir of the foreign repo, run git update-server-fino
- run python -m SimpleHTTPServer 8000
- use git+http://172.17.0.1:8000/ for the URL in e.g. pip install
Now you can co-develop these two things in peace.