2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-10 07:11:00 +00:00
frappe_docker/.github/scripts/WIP_generate_pwd.py
2021-12-16 19:53:24 +03:00

44 lines
930 B
Python

import shutil
import subprocess
from get_latest_tags import get_latest_tag, update_env
def prepare_env():
version = "13"
frappe_tag = get_latest_tag("frappe", version)
erpnext_tag = get_latest_tag("erpnext", version)
shutil.copyfile("example.env", ".env")
update_env(".env", frappe_tag, erpnext_tag)
def generate_compose_file():
output = subprocess.check_output(
(
"docker-compose",
"-f",
"compose.yaml",
"-f",
"overrides/compose.erpnext.yaml",
"--env-file",
".env",
"config",
),
encoding="UTF-8",
)
text = f'version: "3.9"\n\n{output}'
with open("pwd.yml", "a+") as f:
f.seek(0)
f.truncate()
f.write(text)
def main() -> int:
prepare_env()
generate_compose_file()
return 0
if __name__ == "__main__":
raise SystemExit(main())