memcached-formula/tools/filltmpl.py
2018-05-17 18:29:00 -05:00

28 lines
587 B
Python

import os
import sys
from jinja2 import Template
# base/tests
dir_path = os.path.dirname(os.path.realpath(__file__))
# base
base_path = os.path.dirname(dir_path)
if __name__ == '__main__':
formula_name = sys.argv[1]
image_tag = sys.argv[2]
template = Template(
open(os.path.join(dir_path, 'templates', 'Dockerfile.j2')).read()
)
dockerfile = template.render({
'formula_name': formula_name,
'image_tag': image_tag
})
with open(os.path.join(base_path, 'Dockerfile.{}'.format(image_tag)), 'w') as fh:
fh.write(dockerfile)