Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ The values that are used to populate the templates are found in values.yaml.

Rather than modifying the Dockerfiles directly, the `.j2` template should be changed and the Dockerfiles regenerated.

```sh
uv run template.py
```

Or, if you don't have `uv` installed:

```sh
python3 -m pip install Jinja2 pyyaml
python3 template.py values.yaml
python3 template.py
```

## Notes:
Expand Down
15 changes: 13 additions & 2 deletions template.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "jinja2",
# "pyyaml",
# ]
# ///
import argparse
from pathlib import Path

Expand All @@ -10,7 +18,9 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"filename",
type=argparse.FileType("r"),
type=Path,
nargs="?",
default=Path("values.yaml"),
help="Configuration file, e.g. `values.yaml`",
)
parser.add_argument(
Expand All @@ -33,7 +43,8 @@ def main():
loader=FileSystemLoader(args.template_dir), autoescape=select_autoescape()
)

values = yaml.safe_load(args.filename)
with args.filename.open("r") as f:
values = yaml.safe_load(f)
for compiler in values.get("compilers", []):
if "arch" in compiler:
target_path = (
Expand Down