Skip to content

Commit 2157682

Browse files
committed
udpate
1 parent 4263570 commit 2157682

File tree

4 files changed

+59
-25
lines changed

4 files changed

+59
-25
lines changed

.github/workflows/update.yml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
poetry --version
3535
poetry install
3636
poetry run python scripts/update.py
37+
poetry run python scripts/generate_bake.py
3738
3839
- name: Set up QEMU
3940
uses: docker/setup-qemu-action@v3

bakefiles/bakefile.json

+10-25
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,43 @@
11
{
22
"target": {
33
"default": {
4-
"depends": ["radian", "radian-verse", "cmdstan-verse", "cmdstan-verse-zsh"]
4+
"depends": [
5+
"radian", "radian-verse", "cmdstan-verse", "cmdstan-verse-zsh" ]
56
},
67
"radian": {
78
"context": ".",
89
"dockerfile": "images/radian_4.3.2/Dockerfile",
910
"tags": ["mattocci/radian:4.3.2"],
1011
"platforms": ["linux/amd64", "linux/arm64"],
11-
"cache-from": [
12-
"docker.io/mattocci/radian:4.3.2"
13-
],
14-
"cache-to": [
15-
"type=inline"
16-
],
12+
"cache-from": ["docker.io/mattocci/radian:4.3.2"],
13+
"cache-to": ["type=inline"],
1714
"output": ["type=registry,push=true"]
1815
},
1916
"radian-verse": {
2017
"context": ".",
2118
"dockerfile": "images/radian-verse_4.3.2/Dockerfile",
2219
"tags": ["mattocci/radian-verse:4.3.2"],
2320
"platforms": ["linux/amd64", "linux/arm64"],
24-
"cache-from": [
25-
"docker.io/mattocci/radian-verse:4.3.2"
26-
],
27-
"cache-to": [
28-
"type=inline"
29-
],
21+
"cache-from": ["docker.io/mattocci/radian-verse:4.3.2"],
22+
"cache-to": ["type=inline"],
3023
"output": ["type=registry,push=true"]
3124
},
3225
"cmdstan-verse": {
3326
"context": ".",
3427
"dockerfile": "images/cmdstan-verse_4.3.2/Dockerfile",
3528
"tags": ["mattocci/cmdstan-verse:4.3.2"],
3629
"platforms": ["linux/amd64", "linux/arm64"],
37-
"cache-from": [
38-
"docker.io/mattocci/cmdstan-verse:4.3.2"
39-
],
40-
"cache-to": [
41-
"type=inline"
42-
],
30+
"cache-from": ["docker.io/mattocci/cmdstan-verse:4.3.2"],
31+
"cache-to": ["type=inline"],
4332
"output": ["type=registry,push=true"]
4433
},
4534
"cmdstan-verse-zsh": {
4635
"context": ".",
4736
"dockerfile": "images/cmdstan-verse-zsh_4.3.2/Dockerfile",
4837
"tags": ["mattocci/cmdstan-verse-zsh:4.3.2"],
4938
"platforms": ["linux/amd64", "linux/arm64"],
50-
"cache-from": [
51-
"docker.io/mattocci/cmdstan-verse-zsh:4.3.2"
52-
],
53-
"cache-to": [
54-
"type=inline"
55-
],
39+
"cache-from": ["docker.io/mattocci/cmdstan-verse-zsh:4.3.2"],
40+
"cache-to": ["type=inline"],
5641
"output": ["type=registry,push=true"]
5742
}
5843
}

scripts/generate_bake.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import json
2+
from jinja2 import Environment, FileSystemLoader
3+
4+
def main():
5+
# Load the images.json data
6+
with open('images.json') as f:
7+
images_data = json.load(f)
8+
9+
# Set up the Jinja environment
10+
env = Environment(loader=FileSystemLoader('.'), trim_blocks=True, lstrip_blocks=True)
11+
12+
# Load the template
13+
template = env.get_template('templates/bakefile_template.jinja')
14+
15+
# Render the template with the images data
16+
rendered_bakefile = template.render(images=images_data)
17+
18+
# Write the rendered bakefile to bakefile.json
19+
with open('bakefiles/bakefile.json', 'w') as f:
20+
f.write(rendered_bakefile)
21+
22+
print('Generated bakefiles/bakefile.json')
23+
24+
if __name__ == '__main__':
25+
main()

templates/bakefile_template.jinja

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"target": {
3+
"default": {
4+
"depends": [
5+
{% for config in images.configs %}
6+
"{{ config.imageName }}"{% if not loop.last %},{% endif %}
7+
{% endfor %}
8+
]
9+
},
10+
{% for config in images.configs %}
11+
"{{ config.imageName }}": {
12+
"context": ".",
13+
"dockerfile": "images/{{ config.imageTag }}/Dockerfile",
14+
"tags": ["{{ images.owner }}/{{ config.imageName }}:{{ config.imageVer }}"],
15+
"platforms": ["linux/amd64", "linux/arm64"],
16+
"cache-from": ["docker.io/{{ images.owner }}/{{ config.imageName }}:{{ config.imageVer }}"],
17+
"cache-to": ["type=inline"],
18+
"output": ["type=registry,push=true"]
19+
}{% if not loop.last %},{% endif %}
20+
21+
{% endfor %}
22+
}
23+
}

0 commit comments

Comments
 (0)