Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22f6d4d

Browse files
committed
Add forgotten file
1 parent 5d34026 commit 22f6d4d

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

make_images.py

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env python
2+
3+
import subprocess
4+
5+
DOCKER_ID = 'pathman'
6+
pg_versions = ['9.5','9.6','10']
7+
8+
image_types = {
9+
'clang_check_code': {
10+
'CHECK_CODE': 'clang',
11+
},
12+
'cppcheck': {
13+
'CHECK_CODE': 'cppcheck',
14+
},
15+
'pathman_tests': {
16+
'CHECK_CODE': 'false',
17+
}
18+
}
19+
20+
stopline = '###STOP'
21+
22+
password = input("Enter password for `docker login`: ")
23+
subprocess.check_output([
24+
'docker',
25+
'login',
26+
'-u', DOCKER_ID,
27+
'-p', password])
28+
29+
for pg_version in pg_versions:
30+
pgname = 'pg%s' % pg_version.replace('.', '')
31+
for key, variables in image_types.items():
32+
image_name = '%s/%s_%s' % (DOCKER_ID, pgname, key)
33+
with open('Dockerfile', 'w') as out:
34+
with open('Dockerfile.tmpl', 'r') as f:
35+
for line in f:
36+
if line.startswith(stopline):
37+
break
38+
39+
line = line
40+
line = line.replace('${PG_VERSION}', pg_version)
41+
for key, value in variables.items():
42+
varname = '${%s}' % key
43+
line = line.replace(varname, value)
44+
45+
out.write(line)
46+
47+
args = [
48+
'docker',
49+
'build',
50+
'-t', image_name,
51+
'.'
52+
]
53+
subprocess.check_output(args, stderr=subprocess.STDOUT)
54+
print("build ok:", image_name)
55+
subprocess.check_output(['docker', 'push', image_name],
56+
stderr=subprocess.STDOUT)
57+
print("upload ok:", image_name)
58+
exit()

0 commit comments

Comments
 (0)