initial commit

static docker registry is working
This commit is contained in:
Maximilian Güntner
2020-06-19 17:00:37 +02:00
commit 4e95a1c0c8
6 changed files with 97 additions and 0 deletions

24
build_registry.py Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env python3
from pathlib import Path
pathlist = Path("static_registry").glob('**/*.tar.gz')
registry = {
}
def build_images(name, images):
return '{\n' + "\n".join([ f' {name}_{tag} = {{ image = "${{{image}}}"; tag = "{name}:{tag}"; }};' for tag, image in images.items() ]) + '\n };'
def build_registry(registry):
return '{\n' + "\n".join([ f' {name} = ' + build_images(name, images) for name, images in registry.items() ]) + '\n}'
def print_registry(registry):
print(build_registry(registry))
for path in pathlist:
name = path.parts[-2]
image = str(path.resolve())
tag = path.parts[-1].split('.', 1)[0]
if name not in registry:
registry[name] = {}
registry[name][tag] = image
print_registry(registry)