subfuzion / envtpl Goto Github PK
View Code? Open in Web Editor NEWRender Go templates on the command line with shell environment variables
Home Page: https://hub.docker.com/r/subfuzion/envtpl/
License: MIT License
Render Go templates on the command line with shell environment variables
Home Page: https://hub.docker.com/r/subfuzion/envtpl/
License: MIT License
the docker image "scratch" not have "bash/sh", maby change alipine or busybox image?
the scratch not support Dockerfile RUN command.
FROM subfuzion/envtpl
WORKDIR /app
RUN /bin/envtpl /app/tmpl/aaa.conf -o /app/gen/aaa.conf
RUN /bin/envtpl /app/tmpl/bbb.conf -o /app/gen/bbb.conf
/*
container_linux.go:235: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory"
ERROR: Service 'init_gen' failed to build: oci runtime error: container_linux.go:235: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory"
*/
# must use RUN ["/bin/envtpl", "/app/tmpl/aaa.conf", "-o", "/app/gen/aaa.conf"]
if i will render multi file, can not support a easy config in docker-compose.yml ,
sample:
image: subfuzion/envtpl # or use tag "subfuzion/envtpl:alipine"
entrypoint:
- sh # or bash
- -c
- |
mkdir -p /app/gen
envtpl /app/tmpl/aaa.conf -o /app/gen/aaa.conf
envtpl /app/tmpl/bbb.conf -o /app/gen/ccc.conf
Hi,
I am trying to use envtpl to render Prometheus configs.
Prometheus uses the same template engine, so the result is mixed template configurations.
Allowing to change the default delimiters for envtpl will resolve the issue.
It would be great to have a flag that stops envtpl with an error if any keys are missing.
It seems it's just a matter of setting the missingkey option for the template (I just applied that in my fork)
PS thanks for this tool!
Currently the Docker Hub build requires that the alpine binary envtpl
be built and pushed to master. If not, the build fails. This needs to be changed.
I just created a fork so that we can continuing using this utility.
https://github.com/chenrui333/envtpl
/code # pip install -U jinja2
Requirement already satisfied: jinja2 in /usr/lib/python3.9/site-packages (3.0.3)
Collecting jinja2
Using cached Jinja2-3.1.0-py3-none-any.whl (132 kB)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/lib/python3.9/site-packages (from jinja2) (2.1.1)
Installing collected packages: jinja2
Attempting uninstall: jinja2
Found existing installation: Jinja2 3.0.3
Uninstalling Jinja2-3.0.3:
Successfully uninstalled Jinja2-3.0.3
Successfully installed jinja2-3.1.0
/code # envtpl < ci-templates/service-frontend.yml.j2 > service.yml
Traceback (most recent call last):
File "/usr/bin/envtpl", line 33, in <module>
sys.exit(load_entry_point('envtpl==0.6.0', 'console_scripts', 'envtpl')())
File "/usr/bin/envtpl", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/lib/python3.9/site-packages/envtpl.py", line 150, in <module>
@jinja2.contextfunction
AttributeError: module 'jinja2' has no attribute 'contextfunction'
I would like to do
COPY --from=subfuzion/envtpl:v1.0.0 /bin/envtpl /bin/envtpl
in my Dockerfile. However, there is just the latest
tag on dockerhub.
I'd appreciate if you could release it with docker build tags aligned with git tags.
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.