Skip to main content

Generate dockerfiles from pip requirements.txt

Project description

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 like this:

{% for req in pip_requirements %}
RUN pip install --upgrade {{ req }}{% endfor%}

djtempl will pass in a tuple called pip_requirements into the template context.

python djtempl.py -t ./Dockerfile.tmpl -p ./requirements.txt -d ./Dockerfile.out -q``

Installation

Sorry, you’re on your own until I find time to learn pipy packaging.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djtempl-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djtempl-1.0.0-py2-none-any.whl (5.6 kB view details)

Uploaded Python 2

File details

Details for the file djtempl-1.0.0.tar.gz.

File metadata

  • Download URL: djtempl-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for djtempl-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4224c389bc0a22e6fc10d57a75f9a589785c3bc211cd66a593350cb1a099834e
MD5 dc5b3b193c99a8f6bfb0ca0250a12192
BLAKE2b-256 03842404988157926588cb245b15736b0c71383068b259761b5d3f95bf858bb7

See more details on using hashes here.

File details

Details for the file djtempl-1.0.0-py2-none-any.whl.

File metadata

File hashes

Hashes for djtempl-1.0.0-py2-none-any.whl
Algorithm Hash digest
SHA256 2e3c5e730f430607c3ffbf0a0b4d969efe153c4a1d812f9b48eda3220db1b008
MD5 871a7ea86c142f89d835a49f08c6804e
BLAKE2b-256 27d0ca7b4c8258fb0c1d0c4f93cb6c25288df836965a9fd610e72682fa6c3f35

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page