Skip to main content

Posts

Showing posts from October, 2017

Docker: Develop with Private Git Repositories in requirements.txt file

In trying to define my ideal Docker and Django development setup, I've been looking for a solution to the following needs:
I've often found the need to install my project's private Git repositories into Docker container via a standard requirements.txt file. I also want to easily develop on those private Git repositories, in addition to the Git repo main project repository that contains my Django project. As you've probably encountered, a standard pip requirements file for installing both pypi packages and private Git repos might look something like the following.

# requirements.txt
django=1.11.3
-e git+git@github.com:my_github_user/repo_1.git#egg=my_project1
-e git+git@github.com:my_github_user/repo_2.git@my_branch@egg=my_project2

If you are not using Docker and you run pip install -r requirements.txt inside of a virtualenv, pip will download pypi packages (in this case Django) into the lib/python3.x/site-packages/ directory of your virtualenv and will create Git checkout…