Docker hub enforced rate limits starting with November 2020.
Github Docker Image as package
environ('your_env_var')Check jinja2-cli commands for all supported formats.
docker run --rm \
-v **TEMPLATE_FOLDER**:/templates \
-v **VARIABLES_FOLDER**:/variables \
-e CUSTOM_ENV_VAR=**VALUE** \
dinutac/jinja2docker:latest /templates/json.j2 /variables/json.json --format=json > **OUTPUT_FILE**
Example 1:
docker run --rm
-v $PWD/inputs/templates:/templates
-v $PWD/inputs/variables:/variables \
-e DATABASE=mysql56 -e IMAGE=latest \
dinutac/jinja2docker:latest /templates/standalone.j2 /variables/variables.yml --format=yaml > docker-compose.yml
Example 2:
docker run --rm
-v $PWD/inputs/templates:/templates
-v $PWD/inputs/variables:/variables
dinutac/jinja2docker:latest /templates/json.j2 /variables/json.json --format=json
template.json
Os: {{os}}
Flavour: {{flavour}}
Path: {{environ('PATH')}}
variables.json
{
"os" : "Linux",
"flavour": "CentOS"
}
result.json
Os: Linux
Flavour: CentOS
Path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
If you want to use the custom embedded render you must override the entrypoint with /scripts/entities/render.py. It supports:
Example:
docker run --rm --entrypoint /scripts/entities/render.py
-e DATABASE=mysql56 -e IMAGE=latest
dinutac/jinja2docker:latest json.j2 /variables/json.json
The call is similar to jinja2-cli default render, but the template is called by name, not by path. The template must exist in /templates dir.
If you want to write your own custom jinja2 render:
render.py file (you must use this file name) in /scripts/entities/render.py in order to execute your own logic.Content type
Image
Digest
sha256:9340dde8a…
Size
29.9 MB
Last updated
over 2 years ago
docker pull dinutac/jinja2docker