10
10
from urllib .request import urlopen
11
11
12
12
DOCKER_ID = 'pathman'
13
- ALPINE_BASE_URL = 'https://raw.githubusercontent.com/docker-library/postgres/master/9.6 /alpine/'
13
+ ALPINE_BASE_URL = 'https://raw.githubusercontent.com/docker-library/postgres/master/10 /alpine/'
14
14
ALPINE_ENTRYPOINT = 'docker-entrypoint.sh'
15
15
ALPINE_PATCH = b'''
16
- diff --git a/Dockerfile b/Dockerfile
17
- index 9878023..ba215bc 100644
18
- --- a/Dockerfile
19
- +++ b/Dockerfile
20
- @@ -80,6 +80,7 @@ RUN set -ex \\
21
- # configure options taken from:
22
- # https://anonscm.debian.org/cgit/pkg-postgresql/postgresql.git/tree/debian/rules?h=9.5
23
- && ./configure \\
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 \\
24
22
+ --enable-cassert \\
25
- --build="$gnuArch" \\
26
- # "/usr/src/postgresql/src/backend/access/common/tupconvert.c:105: undefined reference to `libintl_gettext'"
27
- # --enable-nls \\
23
+ # skip debugging info -- we want tiny size instead
24
+ # --enable-debug \\
25
+ --disable-rpath \\
26
+
28
27
'''
29
28
CUSTOM_IMAGE_NAME = "%s/postgres_stable" % DOCKER_ID
30
29
@@ -34,16 +33,20 @@ def make_alpine_image(image_name):
34
33
35
34
with tempfile .TemporaryDirectory () as tmpdir :
36
35
print ("Creating build in %s" % tmpdir )
36
+ patch_name = os .path .join (tmpdir , "cassert.patch" )
37
+
37
38
with open (os .path .join (tmpdir , 'Dockerfile' ), 'w' ) as f :
38
39
f .write (dockerfile .decode ())
39
40
40
41
with open (os .path .join (tmpdir , ALPINE_ENTRYPOINT ), 'w' ) as f :
41
42
f .write (entrypoint_sh .decode ())
42
43
43
- with open (os . path . join ( tmpdir , 'cassert.patch' ) , 'w' ) as f :
44
+ with open (patch_name , 'w' ) as f :
44
45
f .write (ALPINE_PATCH .decode ())
45
46
46
- subprocess .check_output (["git" , "apply" , "cassert.patch" ], cwd = tmpdir )
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 ()))
47
50
print ("patch applied" )
48
51
subprocess .check_output (["docker" , "build" , "." , '-t' , image_name ], cwd = tmpdir )
49
52
print ("build ok: " , image_name )
@@ -57,7 +60,7 @@ def make_alpine_image(image_name):
57
60
('pg95' , 'postgres:9.5-alpine' ),
58
61
('pg96' , 'postgres:9.6-alpine' ),
59
62
('pg10' , 'postgres:10-alpine' ),
60
- ('pg96_ca ' , CUSTOM_IMAGE_NAME ),
63
+ ('pg10_ca ' , CUSTOM_IMAGE_NAME ),
61
64
]
62
65
63
66
image_types = {
0 commit comments