Varken/manifest_generator.py

38 lines
977 B
Python
Raw Normal View History

2019-01-16 10:44:18 -08:00
import yaml
from varken import VERSION
org = 'boerderij'
project = 'varken'
2019-01-16 11:12:57 -08:00
namespace = "{}/{}".format(org, project)
2019-01-16 10:44:18 -08:00
yaml_arr = []
tags = ['latest', VERSION]
# Docker image, arch, variant, os
arch_list = [('arm', 'arm', 'v6', 'linux'),
('armhf', 'arm', 'v7', 'linux'),
('arm64', 'arm64', 'v8', 'linux'),
('amd64', 'amd64', None, 'linux')]
for tag in tags:
yaml_doc = {
2019-01-16 11:12:57 -08:00
'image': '{}:{}'.format(namespace, tag),
2019-01-16 10:44:18 -08:00
'manifests': []
}
for arch in arch_list:
info = {
2019-01-16 11:12:57 -08:00
'image': "{}:{}-{}".format(namespace, tag, arch[0]),
2019-01-16 10:44:18 -08:00
'platform': {
'architecture': arch[1],
'os': arch[3]
}
}
if arch[2]:
info['platform']['variant'] = arch[2]
yaml_doc['manifests'].append(info)
yaml_arr.append(yaml_doc)
with open(f".manifest.yaml", 'w') as file:
yaml.dump_all(yaml_arr, file, default_flow_style=False)