Skip to content

Render a dockerfile from a template and pip requirements.txt

License

Notifications You must be signed in to change notification settings

pombredanne/djtempl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Render a dockerfile from a template and pip requirements.txt. Docker caches each dockerfile command in it's own layer. By breaking out requirements.txt, each pip requirement goes into its own layer and build time improves.

Handles all the syntax allowed by pip in requirements.txt

Things like comments, whitespace, line continuations etc. that might choke a simpler solution. Uses the actual parser from pip so guaranteed* compatibility

* or your money back

Usage

Start with a copy your regular Dockerfile called Dockerfile.tmpl

Replace the pip install command that looks something like this:

RUN pip install -r requirements.txt

with some standard django template tags. djtempl will pass a tuple called pip_requirements into the template context.:

{% for req in pip_requirements %}
RUN pip install --upgrade {{ req }}{% endfor%}
djtempl -t ./Dockerfile.tmpl -p ./requirements.txt -d ./Dockerfile.out -q

Installation

pip install djtempl

djtempl.py is pure python and only requires django>=1.8.0

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

About

Render a dockerfile from a template and pip requirements.txt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%