-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-all.py
More file actions
executable file
·36 lines (26 loc) · 1007 Bytes
/
Copy pathbuild-all.py
File metadata and controls
executable file
·36 lines (26 loc) · 1007 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import subprocess
from github import Github
from pathlib import Path
import yaml
REPO_URL="quay.io/nicolerenee"
for filename in glob.iglob('./**/build.yaml', recursive=True):
dir = filename.replace('/build.yaml', '')
dockerfile = Path(dir+'/Dockerfile')
if not dockerfile.is_file():
continue
with open(filename, 'r') as stream:
metadata = yaml.load(stream)
image = "%s/%s:%s" % (REPO_URL, metadata['name'], metadata['version_info']['version'])
buildargs = ""
for k in metadata['version_info'].keys():
buildargs = "%s --build-arg %s=\"%s\"" % (buildargs, k, metadata['version_info'][k])
cmd = "docker build --pull --rm --force-rm %s -t %s %s" % (buildargs, image, dir)
print("DEBUG:::::")
print("DEBUG::::: %s" % (cmd))
print("DEBUG:::::")
subprocess.run(cmd, shell=True, check=True)
cmd = "docker push %s" % image
subprocess.run(cmd, shell=True, check=True)