Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8db528a

Browse files
committed
Merge branch 'rel_future_beta' into fix_merge_partitions
2 parents cc4a3a3 + b0d084f commit 8db528a

File tree

3 files changed

+89
-29
lines changed

3 files changed

+89
-29
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ env:
2626
- DOCKER_IMAGE=pathman/pg10_clang_check_code
2727
- DOCKER_IMAGE=pathman/pg10_cppcheck
2828
- DOCKER_IMAGE=pathman/pg10_pathman_tests
29+
- DOCKER_IMAGE=pathman/pg10_ca_clang_check_code
30+
- DOCKER_IMAGE=pathman/pg10_ca_cppcheck
31+
- DOCKER_IMAGE=pathman/pg10_ca_pathman_tests

Dockerfile.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM postgres:${PG_VERSION}-alpine
1+
FROM ${PG_IMAGE}
22

33
ENV LANG=C.UTF-8 PGDATA=/pg/data
44

make_images.py

Lines changed: 85 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,67 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

3+
import os
34
import subprocess
45
import getpass
6+
import requests
7+
import tempfile
8+
9+
from urllib.parse import urljoin
10+
from urllib.request import urlopen
511

612
DOCKER_ID = 'pathman'
7-
pg_versions = ['9.5','9.6','10']
13+
ALPINE_BASE_URL = 'https://raw.githubusercontent.com/docker-library/postgres/master/10/alpine/'
14+
ALPINE_ENTRYPOINT = 'docker-entrypoint.sh'
15+
ALPINE_PATCH = b'''
16+
--- Dockerfile 2017-07-25 12:43:20.424984422 +0300
17+
+++ Dockerfile 2017-07-25 12:46:10.279267520 +0300
18+
@@ -86,6 +86,7 @@
19+
--enable-integer-datetimes \\
20+
--enable-thread-safety \\
21+
--enable-tap-tests \\
22+
+ --enable-cassert \\
23+
# skip debugging info -- we want tiny size instead
24+
# --enable-debug \\
25+
--disable-rpath \\
26+
27+
'''
28+
CUSTOM_IMAGE_NAME = "%s/postgres_stable" % DOCKER_ID
29+
30+
def make_alpine_image(image_name):
31+
dockerfile = urlopen(urljoin(ALPINE_BASE_URL, 'Dockerfile')).read()
32+
entrypoint_sh = urlopen(urljoin(ALPINE_BASE_URL, ALPINE_ENTRYPOINT)).read()
33+
34+
with tempfile.TemporaryDirectory() as tmpdir:
35+
print("Creating build in %s" % tmpdir)
36+
patch_name = os.path.join(tmpdir, "cassert.patch")
37+
38+
with open(os.path.join(tmpdir, 'Dockerfile'), 'w') as f:
39+
f.write(dockerfile.decode())
40+
41+
with open(os.path.join(tmpdir, ALPINE_ENTRYPOINT), 'w') as f:
42+
f.write(entrypoint_sh.decode())
43+
44+
with open(patch_name, 'w') as f:
45+
f.write(ALPINE_PATCH.decode())
46+
47+
with open(patch_name, 'r') as f:
48+
p = subprocess.Popen(["patch", "-p0"], cwd=tmpdir, stdin=subprocess.PIPE)
49+
p.communicate(str.encode(f.read()))
50+
print("patch applied")
51+
subprocess.check_output(["docker", "build", ".", '-t', image_name], cwd=tmpdir)
52+
print("build ok: ", image_name)
53+
subprocess.check_output(['docker', 'push', image_name],
54+
stderr=subprocess.STDOUT)
55+
print("upload ok:", image_name)
56+
57+
make_alpine_image(CUSTOM_IMAGE_NAME)
58+
59+
pg_containers = [
60+
('pg95', 'postgres:9.5-alpine'),
61+
('pg96', 'postgres:9.6-alpine'),
62+
('pg10', 'postgres:10-alpine'),
63+
('pg10_ca', CUSTOM_IMAGE_NAME),
64+
]
865

966
image_types = {
1067
'clang_check_code': {
@@ -30,32 +87,32 @@
3087
travis_conf = []
3188
print("")
3289

33-
for pg_version in pg_versions:
34-
pgname = 'pg%s' % pg_version.replace('.', '')
35-
for key, variables in image_types.items():
36-
image_name = '%s/%s_%s' % (DOCKER_ID, pgname, key)
37-
with open('Dockerfile', 'w') as out:
38-
with open('Dockerfile.tmpl', 'r') as f:
39-
for line in f:
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-
travis_conf.append(travis_conf_line % image_name)
90+
if __name__ == '__main__':
91+
for pgname, container in pg_containers:
92+
for key, variables in image_types.items():
93+
image_name = '%s/%s_%s' % (DOCKER_ID, pgname, key)
94+
with open('Dockerfile', 'w') as out:
95+
with open('Dockerfile.tmpl', 'r') as f:
96+
for line in f:
97+
line = line.replace('${PG_IMAGE}', container)
98+
for key, value in variables.items():
99+
varname = '${%s}' % key
100+
line = line.replace(varname, value)
101+
102+
out.write(line)
103+
104+
args = [
105+
'docker',
106+
'build',
107+
'-t', image_name,
108+
'.'
109+
]
110+
subprocess.check_output(args, stderr=subprocess.STDOUT)
111+
print("build ok:", image_name)
112+
subprocess.check_output(['docker', 'push', image_name],
113+
stderr=subprocess.STDOUT)
114+
print("upload ok:", image_name)
115+
travis_conf.append(travis_conf_line % image_name)
59116

60117
print("\ntravis configuration")
61118
print('\n'.join(travis_conf))

0 commit comments

Comments
 (0)