-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
render.py
executable file
·148 lines (138 loc) · 4.75 KB
/
render.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/env python3
import os
from jinja2 import Environment, DictLoader, select_autoescape
MANYLINUX2014_CT_NG_VERSION = "02d1503f6769be4ad8058b393d4245febced459f"
MANYLINUX2014_TOOLCHAIN_OS = "ubuntu:20.04"
MANYLINUX_2_28_CT_NG_VERSION = "crosstool-ng-1.25.0"
TOOLCHAIN_OS = "ubuntu:22.04"
IMAGES = {
"manylinux2014": [
{
"arch": "aarch64",
"manylinux": "quay.io/pypa/manylinux2014_aarch64",
"ct_ng_version": MANYLINUX2014_CT_NG_VERSION,
"toolchain_os": MANYLINUX2014_TOOLCHAIN_OS,
"target": "aarch64-unknown-linux-gnu",
},
{
"arch": "armv7l",
"cmake_arch": "armv7",
"ct_ng_version": MANYLINUX2014_CT_NG_VERSION,
"toolchain_os": MANYLINUX2014_TOOLCHAIN_OS,
"target": "armv7-unknown-linux-gnueabihf",
},
{
"arch": "i686",
"manylinux": "quay.io/pypa/manylinux2014_i686",
"ct_ng_version": MANYLINUX2014_CT_NG_VERSION,
"toolchain_os": MANYLINUX2014_TOOLCHAIN_OS,
"target": "i686-unknown-linux-gnu",
},
{
"arch": "ppc64",
"ct_ng_version": MANYLINUX2014_CT_NG_VERSION,
"toolchain_os": MANYLINUX2014_TOOLCHAIN_OS,
"target": "powerpc64-unknown-linux-gnu",
},
{
"arch": "ppc64le",
"manylinux": "quay.io/pypa/manylinux2014_ppc64le",
"ct_ng_version": MANYLINUX2014_CT_NG_VERSION,
"toolchain_os": MANYLINUX2014_TOOLCHAIN_OS,
"target": "powerpc64le-unknown-linux-gnu",
},
{
"arch": "s390x",
"manylinux": "quay.io/pypa/manylinux2014_s390x",
"ct_ng_version": MANYLINUX2014_CT_NG_VERSION,
"toolchain_os": MANYLINUX2014_TOOLCHAIN_OS,
"target": "s390x-ibm-linux-gnu",
},
{
"arch": "x86_64",
"manylinux": "quay.io/pypa/manylinux2014_x86_64",
"ct_ng_version": MANYLINUX2014_CT_NG_VERSION,
"toolchain_os": MANYLINUX2014_TOOLCHAIN_OS,
"target": "x86_64-unknown-linux-gnu",
},
],
"manylinux_2_28": [
{
"arch": "aarch64",
"manylinux": "quay.io/pypa/manylinux_2_28_aarch64",
"ct_ng_version": MANYLINUX_2_28_CT_NG_VERSION,
"toolchain_os": TOOLCHAIN_OS,
"target": "aarch64-unknown-linux-gnu",
},
{
"arch": "ppc64le",
"manylinux": "quay.io/pypa/manylinux_2_28_ppc64le",
"ct_ng_version": MANYLINUX_2_28_CT_NG_VERSION,
"toolchain_os": TOOLCHAIN_OS,
"target": "powerpc64le-unknown-linux-gnu",
},
{
"arch": "x86_64",
"manylinux": "quay.io/pypa/manylinux_2_28_x86_64",
"ct_ng_version": MANYLINUX_2_28_CT_NG_VERSION,
"toolchain_os": TOOLCHAIN_OS,
"target": "x86_64-unknown-linux-gnu",
},
{
"arch": "armv7l",
"ct_ng_version": MANYLINUX_2_28_CT_NG_VERSION,
"toolchain_os": TOOLCHAIN_OS,
"target": "armv7-unknown-linux-gnueabihf",
},
{
"arch": "s390x",
"ct_ng_version": MANYLINUX_2_28_CT_NG_VERSION,
"toolchain_os": TOOLCHAIN_OS,
"target": "s390x-ibm-linux-gnu",
},
],
"musllinux_1_2": [
{
"arch": "aarch64",
"musllinux": "quay.io/pypa/musllinux_1_1_aarch64",
"base": "messense/rust-musl-cross:aarch64-musl",
"target": "aarch64-unknown-linux-gnu",
},
{
"arch": "armv7l",
"base": "messense/rust-musl-cross:armv7-musleabihf",
"target": "armv7-unknown-linux-musleabihf",
},
{
"arch": "i686",
"musllinux": "quay.io/pypa/musllinux_1_1_i686",
"base": "messense/rust-musl-cross:i686-musl",
},
{
"arch": "x86_64",
"musllinux": "quay.io/pypa/musllinux_1_1_x86_64",
"base": "messense/rust-musl-cross:x86_64-musl",
},
],
}
with open("Dockerfile.j2") as f:
env = Environment(
loader=DictLoader(
{
"dockerfile": f.read(),
}
),
autoescape=select_autoescape(),
)
def main():
template = env.get_template("dockerfile")
for platform, images in IMAGES.items():
for image in images:
arch = image["arch"]
output = template.render(**image)
folder = os.path.join(platform, arch)
os.makedirs(folder, exist_ok=True)
with open(os.path.join(folder, "Dockerfile"), "w") as f:
f.write(output)
if __name__ == "__main__":
main()