Skip to content

stefanbudim/minijinja-cli-docker

Repository files navigation

A CLI tool to render Jinja2 templates.

Features

  • single command line execution
  • shell scripting
  • steps in CI/CD pipelines with minimal overhead and setup
  • fast template rendering as the Rust implementation is much faster than Python
  • no dependencies required / no python required

Usage

To render a file

docker run --rm -v ".:/data" stefanbudim/minijinja-cli \
/data/service-template.j2 /data/service-data.yaml  > /etc/systemd/system/my.service

This will create file my.service

[Unit]
Description=My Custom Application Service
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/myapp --config /etc/myapp/config.yaml
Restart=on-failure
User=myappuser

[Install]
WantedBy=multi-user.target

Based on template and data files:

service-template.j2

[Unit]
Description={{ description }}
After=network.target

[Service]
Type=simple
ExecStart={{ exec_start }}
Restart=on-failure
User={{ user }}

[Install]
WantedBy=multi-user.target

service-data.j2

description: My Custom Application Service
exec_start: /usr/bin/myapp --config /etc/myapp/config.yaml
user: myappuser

Examples

examples

Deep Dive

Generating Kubernetes YAML Files with Jinja2 Templates

Releases

docker hub

Create a new Release

Create a git tag with a semVer version number e.g. 2.20.2

./tag-create-push.sh 2.10.2

Once the tag is pushed a github action workflow will automatically start.

The new release will be publised on docker hub. Docker tag will be the same as the git tag.

Credits

Similar Tools

About

A CLI tool to render Jinja2 templates

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors