diff --git a/.gitignore b/.gitignore index a42f474..e93c2f3 100644 --- a/.gitignore +++ b/.gitignore @@ -125,4 +125,7 @@ DockerFile # Go compiled binaries app/*/api/api app/*/rpc/rpc -app/*/mq/mq \ No newline at end of file +app/*/mq/mq + +# Build artifacts +.bake.json \ No newline at end of file diff --git a/deploy/dev/build.py b/deploy/dev/build.py index 441b80c..b6361cf 100644 --- a/deploy/dev/build.py +++ b/deploy/dev/build.py @@ -5,7 +5,6 @@ import json import os import subprocess import sys -import tempfile from glob import glob from pathlib import Path @@ -100,21 +99,20 @@ def main(): "target": targets, } - fd, bakefile = tempfile.mkstemp(prefix="juwan-bake-", suffix=".json") + bakefile = ROOT_DIR / ".bake.json" try: - with os.fdopen(fd, "w") as f: - json.dump(bake, f, indent=2) + bakefile.write_text(json.dumps(bake, indent=2)) print(f"Generated {len(targets)} targets -> {bakefile}") names = list(targets.keys()) for i in range(0, len(names), BAKE_BATCH_SIZE): batch = names[i : i + BAKE_BATCH_SIZE] subprocess.run( - ["docker", "buildx", "bake", "--load", "-f", bakefile, *batch], + ["docker", "buildx", "bake", "--load", "-f", str(bakefile), *batch], check=True, ) finally: - os.unlink(bakefile) + bakefile.unlink(missing_ok=True) main()