Saltstack Official Nginx Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

28 行
587B

  1. import os
  2. import sys
  3. from jinja2 import Template
  4. # base/tests
  5. dir_path = os.path.dirname(os.path.realpath(__file__))
  6. # base
  7. base_path = os.path.dirname(dir_path)
  8. if __name__ == '__main__':
  9. formula_name = sys.argv[1]
  10. image_tag = sys.argv[2]
  11. template = Template(
  12. open(os.path.join(dir_path, 'templates', 'Dockerfile.j2')).read()
  13. )
  14. dockerfile = template.render({
  15. 'formula_name': formula_name,
  16. 'image_tag': image_tag
  17. })
  18. with open(os.path.join(base_path, 'Dockerfile.{}'.format(image_tag)), 'w') as fh:
  19. fh.write(dockerfile)