{ "info": { "author": "Johan Andersson", "author_email": "Grokzen@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "docker-jinja - dj\n=================\n\nExtend your dockerfiles with Jinja2 syntax and logic.\n\nCreate new filter and functions for Jinja with simple datasource files.\n\nBuild status: [![Build Status](https://travis-ci.org/Grokzen/docker-jinja.svg?branch=master)](https://travis-ci.org/Grokzen/docker-jinja) [![Coverage Status](https://coveralls.io/repos/Grokzen/docker-jinja/badge.png)](https://coveralls.io/r/Grokzen/docker-jinja)\n\n\n\nInstallation\n------------\n\nInstall from pypi with `pip install docker-jinja`\n\nTo install in development mode, first navigate to root of project and then run `pip install -r dev-requirements.txt; pip install -e .`. It is recommended to install inside a virtualenv to avoid conflicts with dependencies.\n\n\n\nQuickstart guide\n----------------\n\nCreate a Dockerfile.jinja that contains all regular Dockerfile build steps and the jinja syntax. For exapmle:\n\n```\n$ cat Dockerfile.jinja \nFROM {{ OS }}\nMAINTAINER {{ MAINTAINER }} \n\nARG {{ ARG1 }}\n```\n\nRun `dj` command. For example:\n\n```\ndj --dockerfile Dockerfile.jinja --outfile Dockerfile --env OS=ubuntu:12.04 --env MAINTAINER=Grokzen --env ARG1=foobar --config test-config.json\n```\n\nAnd you will get the output:\n\n```\nFROM ubuntu:12.04\nMAINTAINER Grokzen\n\nARG foobar\n```\n\n\nConfiguration files\n-------------------\n\nIt is possible to create predefined configuration files with settings, enviroment variables and datasources.\n\n`dj` tries to load the following configuration files in the following order:\n\n- /etc/dj.yaml\n- /etc/dj.json\n- ~/.dj.yaml\n- ~/.dj.json\n- $CWD + '.dj.yaml'\n- $CWD + '.dj.json'\n\nYAML is the file format to prefer but json is also supported.\n\nCurrently it is not possible to automatically load a config file next to the source Dockerfile.\n\n\n\nDatasources\n-----------\n\nIf you want to extend the Jinja syntax with additional filters and global functions you have the datasource pattern to help you.\n\nA datasource file is a python script that can contain any code you want so you can extend `dj` to be capable to perform any task you want.\n\nYou can tell `dj` to load a datasource file in multiple ways.\n\n- In any config file create a key `datasources` with a list of strings paths pointing to all files that `dj` should import. (Must be absolute path)\n- Point to a file with cli key -s/--datasource and `dj` will load that file. (Relative paths is supported)\n- Add a python file to contrib folder and it will auto load during execution.\n\n\n\nGlobal functions\n################\n\nA global function is a regular python function that you can call from jinja. These functions can be used to perform any usefull task you require.\n\nTo create a global function you define a method within a datasource and its name should starts with `_global_` and then follow by the name you want to use in your Dockerfile.\n\nFor example if you have the following code:\n\n```python\ndef _global_foo():\n return \"bar\" \n```\n\nYou can call it from jinja with:\n\n```Shell\nRUN echo '{{ foo() }}'\n```\n\nand it will render into\n\n```Shell\nRUN echo 'bar'\n```\n\n\n\nFilter functions\n################\n\nTo create a new filter function you define a method within a datasource and its name should starts with `_filter_` and then follow by the name you want to use in your Dockerfile.\n\nFor example if you have the following code\n\n```python\ndef _filter_bar(arg):\n return arg.upper()\n```\n\nYou can call it from jinja with:\n\n```Shell\nRUN echo '{{ \"opa\"|bar }}'\n```\n\nand it will render into\n\n```Shell\nRUN echo 'OPA'\n```\n\n\n\nOther rendering engines\n-----------------------\n\nCurrently only Jinja2 is supported as rendering engine\n\n\n\nSupported python version\n------------------------\n\n- 2.7\n- 3.3\n- 3.4\n\nPython 3.2 will not be supported because Jinja2 is only supported on python >= 3.3 (Reference: http://jinja.pocoo.org/docs/intro/). If other rendering engines would be supported then python 3.2 can be supported for those engines.\n\n\n\nContribute\n----------\n\nOpen an Issue on github describing the problem you have.\n\nIf you have a fix for the problem or want to add something to contrib library, open a PR with your fix. The PR must contain some test to verify that it work if it is a bugfix or new feature. All tests in all supported python environments must pass on TravisCI before a PR will be accepted.\n\nAll PR:s should have their commits squashed to a single commit.\n\n\n\nLicense\n=======\n\nSee LICENSE file. (MIT)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Grokzen/docker-jinja", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "docker-jinja", "package_url": "https://pypi.org/project/docker-jinja/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/docker-jinja/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Grokzen/docker-jinja" }, "release_url": "https://pypi.org/project/docker-jinja/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "Extend your dockerfiles with Jinja2 syntax to to more awesome dockerfiles", "version": "1.0.0" }, "last_serial": 2444039, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "7b8d091b090531c486b430f8676a9fe4", "sha256": "9584222c194d0c0437726d76d6ad77f91c2504e8495b7b3d4779c7128dbdca4b" }, "downloads": -1, "filename": "docker-jinja-1.0.0.tar.gz", "has_sig": false, "md5_digest": "7b8d091b090531c486b430f8676a9fe4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11615, "upload_time": "2016-11-05T11:28:44", "url": "https://files.pythonhosted.org/packages/7c/f3/056e1d86687a9f1255c2b561a54eba33026ab278b2c2866b373c1f3c7f20/docker-jinja-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7b8d091b090531c486b430f8676a9fe4", "sha256": "9584222c194d0c0437726d76d6ad77f91c2504e8495b7b3d4779c7128dbdca4b" }, "downloads": -1, "filename": "docker-jinja-1.0.0.tar.gz", "has_sig": false, "md5_digest": "7b8d091b090531c486b430f8676a9fe4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11615, "upload_time": "2016-11-05T11:28:44", "url": "https://files.pythonhosted.org/packages/7c/f3/056e1d86687a9f1255c2b561a54eba33026ab278b2c2866b373c1f3c7f20/docker-jinja-1.0.0.tar.gz" } ] }