zulip/tools/circleci/generate-dockerfiles

26 lines
713 B
Python
Executable File

#!/usr/bin/env python3
import os
import yaml
if __name__ == "__main__":
os.chdir(os.path.abspath(os.path.dirname(__file__)))
with open("Dockerfile.template") as f:
docker_template = f.read()
with open("images.yml") as f:
dockerfile_settings = yaml.safe_load(f)
for distro in dockerfile_settings:
dockerfile_path = "images/{}/Dockerfile".format(distro)
os.makedirs(os.path.dirname(dockerfile_path), exist_ok=True)
with open(dockerfile_path, "w") as f:
f.write("""\
# THIS IS A GENERATED FILE. DO NOT EDIT.
# See template: tools/circleci/Dockerfile.template
""")
f.write(docker_template.format_map(dockerfile_settings[distro]))