1010from urllib .request import urlopen
1111
1212DOCKER_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/'
1414ALPINE_ENTRYPOINT = 'docker-entrypoint.sh'
1515ALPINE_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 \\
2422+ --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+
2827'''
2928CUSTOM_IMAGE_NAME = "%s/postgres_stable" % DOCKER_ID
3029
@@ -34,16 +33,20 @@ def make_alpine_image(image_name):
3433
3534 with tempfile .TemporaryDirectory () as tmpdir :
3635 print ("Creating build in %s" % tmpdir )
36+ patch_name = os .path .join (tmpdir , "cassert.patch" )
37+
3738 with open (os .path .join (tmpdir , 'Dockerfile' ), 'w' ) as f :
3839 f .write (dockerfile .decode ())
3940
4041 with open (os .path .join (tmpdir , ALPINE_ENTRYPOINT ), 'w' ) as f :
4142 f .write (entrypoint_sh .decode ())
4243
43- with open (os . path . join ( tmpdir , 'cassert.patch' ) , 'w' ) as f :
44+ with open (patch_name , 'w' ) as f :
4445 f .write (ALPINE_PATCH .decode ())
4546
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 ()))
4750 print ("patch applied" )
4851 subprocess .check_output (["docker" , "build" , "." , '-t' , image_name ], cwd = tmpdir )
4952 print ("build ok: " , image_name )
@@ -57,7 +60,7 @@ def make_alpine_image(image_name):
5760 ('pg95' , 'postgres:9.5-alpine' ),
5861 ('pg96' , 'postgres:9.6-alpine' ),
5962 ('pg10' , 'postgres:10-alpine' ),
60- ('pg96_ca ' , CUSTOM_IMAGE_NAME ),
63+ ('pg10_ca ' , CUSTOM_IMAGE_NAME ),
6164]
6265
6366image_types = {
0 commit comments