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

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.

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.1.tar.gz (4.5 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.1-py2-none-any.whl (5.8 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for djtempl-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0ec1ff047f1b2fbb2762010436eae805bef1b3ad9200eca3ab09e1b0e77ec91d
MD5 3b6272c62818ca0b357ec9422a37f999
BLAKE2b-256 e0278f5dead8cd485075bd0265351a47202d87525cac36ed7829635cd4760349

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for djtempl-1.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 d59a3c48623ee70e6e4cea4ded268043342afe53cf8914ecc236d55e060165db
MD5 e698e3ee59c712785b5e50484ad72db4
BLAKE2b-256 699911807ac65ee310395f4ff6debd547d31b2c98a146c4dcecade75a46fa2ec

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