zulip/tools/ci/generate-dockerfiles

28 lines
729 B
Plaintext
Raw Normal View History

#!/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 = f"images/{distro}/Dockerfile"
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/ci/Dockerfile.template
"""
)
f.write(docker_template.format_map(dockerfile_settings[distro]))