Skip to content

Commit 64e333f

Browse files
authored
Merge pull request docker-library#255 from kurlzor/add-ossp-uuid
Add ossp uuid to the alpine 9.2 and 9.3 images
2 parents 7f792e7 + 439c497 commit 64e333f

File tree

8 files changed

+122
-12
lines changed

8 files changed

+122
-12
lines changed

9.2/alpine/Dockerfile

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ ENV PG_MAJOR 9.2
1717
ENV PG_VERSION 9.2.20
1818
ENV PG_SHA256 0b8abdae8400cabea5587a726003c9dd71c73c049bdae523abc35f9312dd8f26
1919

20+
ENV OSSP_UUID_VERSION 1.6.2
21+
ENV OSSP_UUID_SHA256 11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0
22+
2023
RUN set -ex \
2124
\
2225
&& apk add --no-cache --virtual .fetch-deps \
@@ -36,6 +39,7 @@ RUN set -ex \
3639
\
3740
&& apk add --no-cache --virtual .build-deps \
3841
bison \
42+
coreutils \
3943
flex \
4044
gcc \
4145
# krb5-dev \
@@ -54,6 +58,26 @@ RUN set -ex \
5458
util-linux-dev \
5559
zlib-dev \
5660
\
61+
# install OSSP uuid (http://www.ossp.org/pkg/lib/uuid/)
62+
# see https://github.com/docker-library/postgres/pull/255 for more details
63+
&& wget -O uuid.tar.gz "https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-$OSSP_UUID_VERSION.tar.gz" \
64+
&& echo "$OSSP_UUID_SHA256 *uuid.tar.gz" | sha256sum -c - \
65+
&& mkdir -p /usr/src/ossp-uuid \
66+
&& tar \
67+
--extract \
68+
--file uuid.tar.gz \
69+
--directory /usr/src/ossp-uuid \
70+
--strip-components 1 \
71+
&& rm uuid.tar.gz \
72+
&& ( \
73+
cd /usr/src/ossp-uuid \
74+
&& ./configure \
75+
--prefix=/usr/local \
76+
&& make -j "$(nproc)" \
77+
&& make install \
78+
) \
79+
&& rm -rf /usr/src/ossp-uuid \
80+
\
5781
&& cd /usr/src/postgresql \
5882
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
5983
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
@@ -67,15 +91,16 @@ RUN set -ex \
6791
# --enable-nls \
6892
--enable-integer-datetimes \
6993
--enable-thread-safety \
70-
--enable-tap-tests \
7194
# skip debugging info -- we want tiny size instead
7295
# --enable-debug \
7396
--disable-rpath \
74-
--with-uuid=e2fs \
97+
--with-ossp-uuid \
7598
--with-gnu-ld \
7699
--with-pgport=5432 \
77100
--with-system-tzdata=/usr/share/zoneinfo \
78101
--prefix=/usr/local \
102+
--with-includes=/usr/local/include \
103+
--with-libraries=/usr/local/lib \
79104
\
80105
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
81106
# --with-krb5 \
@@ -88,7 +113,7 @@ RUN set -ex \
88113
--with-openssl \
89114
--with-libxml \
90115
--with-libxslt \
91-
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
116+
&& make -j "$(nproc)" world \
92117
&& make install-world \
93118
&& make -C contrib install \
94119
\

9.3/alpine/Dockerfile

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ ENV PG_MAJOR 9.3
1717
ENV PG_VERSION 9.3.16
1818
ENV PG_SHA256 845f5e4ac8cf026b6a77c5a180a2fe869f51e9d06acf8d0365b05505a2c66873
1919

20+
ENV OSSP_UUID_VERSION 1.6.2
21+
ENV OSSP_UUID_SHA256 11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0
22+
2023
RUN set -ex \
2124
\
2225
&& apk add --no-cache --virtual .fetch-deps \
@@ -36,6 +39,7 @@ RUN set -ex \
3639
\
3740
&& apk add --no-cache --virtual .build-deps \
3841
bison \
42+
coreutils \
3943
flex \
4044
gcc \
4145
# krb5-dev \
@@ -54,6 +58,26 @@ RUN set -ex \
5458
util-linux-dev \
5559
zlib-dev \
5660
\
61+
# install OSSP uuid (http://www.ossp.org/pkg/lib/uuid/)
62+
# see https://github.com/docker-library/postgres/pull/255 for more details
63+
&& wget -O uuid.tar.gz "https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-$OSSP_UUID_VERSION.tar.gz" \
64+
&& echo "$OSSP_UUID_SHA256 *uuid.tar.gz" | sha256sum -c - \
65+
&& mkdir -p /usr/src/ossp-uuid \
66+
&& tar \
67+
--extract \
68+
--file uuid.tar.gz \
69+
--directory /usr/src/ossp-uuid \
70+
--strip-components 1 \
71+
&& rm uuid.tar.gz \
72+
&& ( \
73+
cd /usr/src/ossp-uuid \
74+
&& ./configure \
75+
--prefix=/usr/local \
76+
&& make -j "$(nproc)" \
77+
&& make install \
78+
) \
79+
&& rm -rf /usr/src/ossp-uuid \
80+
\
5781
&& cd /usr/src/postgresql \
5882
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
5983
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
@@ -67,15 +91,16 @@ RUN set -ex \
6791
# --enable-nls \
6892
--enable-integer-datetimes \
6993
--enable-thread-safety \
70-
--enable-tap-tests \
7194
# skip debugging info -- we want tiny size instead
7295
# --enable-debug \
7396
--disable-rpath \
74-
--with-uuid=e2fs \
97+
--with-ossp-uuid \
7598
--with-gnu-ld \
7699
--with-pgport=5432 \
77100
--with-system-tzdata=/usr/share/zoneinfo \
78101
--prefix=/usr/local \
102+
--with-includes=/usr/local/include \
103+
--with-libraries=/usr/local/lib \
79104
\
80105
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
81106
# --with-krb5 \
@@ -88,7 +113,7 @@ RUN set -ex \
88113
--with-openssl \
89114
--with-libxml \
90115
--with-libxslt \
91-
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
116+
&& make -j "$(nproc)" world \
92117
&& make install-world \
93118
&& make -C contrib install \
94119
\

9.4/alpine/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ RUN set -ex \
3636
\
3737
&& apk add --no-cache --virtual .build-deps \
3838
bison \
39+
coreutils \
3940
flex \
4041
gcc \
4142
# krb5-dev \
@@ -76,6 +77,8 @@ RUN set -ex \
7677
--with-pgport=5432 \
7778
--with-system-tzdata=/usr/share/zoneinfo \
7879
--prefix=/usr/local \
80+
--with-includes=/usr/local/include \
81+
--with-libraries=/usr/local/lib \
7982
\
8083
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
8184
# --with-krb5 \
@@ -88,7 +91,7 @@ RUN set -ex \
8891
--with-openssl \
8992
--with-libxml \
9093
--with-libxslt \
91-
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
94+
&& make -j "$(nproc)" world \
9295
&& make install-world \
9396
&& make -C contrib install \
9497
\

9.5/alpine/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ RUN set -ex \
3636
\
3737
&& apk add --no-cache --virtual .build-deps \
3838
bison \
39+
coreutils \
3940
flex \
4041
gcc \
4142
# krb5-dev \
@@ -76,6 +77,8 @@ RUN set -ex \
7677
--with-pgport=5432 \
7778
--with-system-tzdata=/usr/share/zoneinfo \
7879
--prefix=/usr/local \
80+
--with-includes=/usr/local/include \
81+
--with-libraries=/usr/local/lib \
7982
\
8083
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
8184
# --with-krb5 \
@@ -88,7 +91,7 @@ RUN set -ex \
8891
--with-openssl \
8992
--with-libxml \
9093
--with-libxslt \
91-
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
94+
&& make -j "$(nproc)" world \
9295
&& make install-world \
9396
&& make -C contrib install \
9497
\

9.6/alpine/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ RUN set -ex \
3636
\
3737
&& apk add --no-cache --virtual .build-deps \
3838
bison \
39+
coreutils \
3940
flex \
4041
gcc \
4142
# krb5-dev \
@@ -76,6 +77,8 @@ RUN set -ex \
7677
--with-pgport=5432 \
7778
--with-system-tzdata=/usr/share/zoneinfo \
7879
--prefix=/usr/local \
80+
--with-includes=/usr/local/include \
81+
--with-libraries=/usr/local/lib \
7982
\
8083
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
8184
# --with-krb5 \
@@ -88,7 +91,7 @@ RUN set -ex \
8891
--with-openssl \
8992
--with-libxml \
9093
--with-libxslt \
91-
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
94+
&& make -j "$(nproc)" world \
9295
&& make install-world \
9396
&& make -C contrib install \
9497
\

Dockerfile-alpine.template

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ENV PG_MAJOR %%PG_MAJOR%%
1717
ENV PG_VERSION %%PG_VERSION%%
1818
ENV PG_SHA256 %%PG_SHA256%%
1919

20+
%%OSSP_UUID_ENV_VARS%%
2021
RUN set -ex \
2122
\
2223
&& apk add --no-cache --virtual .fetch-deps \
@@ -36,6 +37,7 @@ RUN set -ex \
3637
\
3738
&& apk add --no-cache --virtual .build-deps \
3839
bison \
40+
coreutils \
3941
flex \
4042
gcc \
4143
# krb5-dev \
@@ -54,6 +56,7 @@ RUN set -ex \
5456
util-linux-dev \
5557
zlib-dev \
5658
\
59+
%%INSTALL_OSSP_UUID%%
5760
&& cd /usr/src/postgresql \
5861
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
5962
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
@@ -71,11 +74,13 @@ RUN set -ex \
7174
# skip debugging info -- we want tiny size instead
7275
# --enable-debug \
7376
--disable-rpath \
74-
--with-uuid=e2fs \
77+
%%UUID_CONFIG_FLAG%% \
7578
--with-gnu-ld \
7679
--with-pgport=5432 \
7780
--with-system-tzdata=/usr/share/zoneinfo \
7881
--prefix=/usr/local \
82+
--with-includes=/usr/local/include \
83+
--with-libraries=/usr/local/lib \
7984
\
8085
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
8186
# --with-krb5 \
@@ -88,7 +93,7 @@ RUN set -ex \
8893
--with-openssl \
8994
--with-libxml \
9095
--with-libxslt \
91-
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
96+
&& make -j "$(nproc)" world \
9297
&& make install-world \
9398
&& make -C contrib install \
9499
\

ossp-uuid.template

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# install OSSP uuid (http://www.ossp.org/pkg/lib/uuid/)
2+
# see https://github.com/docker-library/postgres/pull/255 for more details
3+
&& wget -O uuid.tar.gz "https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-$OSSP_UUID_VERSION.tar.gz" \
4+
&& echo "$OSSP_UUID_SHA256 *uuid.tar.gz" | sha256sum -c - \
5+
&& mkdir -p /usr/src/ossp-uuid \
6+
&& tar \
7+
--extract \
8+
--file uuid.tar.gz \
9+
--directory /usr/src/ossp-uuid \
10+
--strip-components 1 \
11+
&& rm uuid.tar.gz \
12+
&& ( \
13+
cd /usr/src/ossp-uuid \
14+
&& ./configure \
15+
--prefix=/usr/local \
16+
&& make -j "$(nproc)" \
17+
&& make install \
18+
) \
19+
&& rm -rf /usr/src/ossp-uuid \
20+
\

update.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ versions=( "${versions[@]%/}" )
1212
packagesBase='http://apt.postgresql.org/pub/repos/apt/dists/jessie-pgdg'
1313
mainList="$(curl -fsSL "$packagesBase/main/binary-amd64/Packages.bz2" | bunzip2)"
1414

15+
# https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/?C=M;O=D
16+
osspUuidVersion='1.6.2'
17+
osspUuidHash='11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0'
18+
1519
travisEnv=
1620
for version in "${versions[@]}"; do
1721
versionList="$(echo "$mainList"; curl -fsSL "$packagesBase/$version/binary-amd64/Packages.bz2" | bunzip2)"
@@ -33,7 +37,29 @@ for version in "${versions[@]}"; do
3337
set -x
3438
cp docker-entrypoint.sh "$version/$variant/"
3539
sed -i 's/gosu/su-exec/g' "$version/$variant/docker-entrypoint.sh"
36-
sed 's/%%PG_MAJOR%%/'"$version"'/g; s/%%PG_VERSION%%/'"$srcVersion"'/g; s/%%PG_SHA256%%/'"$srcSha256"'/g' Dockerfile-$variant.template > "$version/$variant/Dockerfile"
40+
sed -e 's/%%PG_MAJOR%%/'"$version"'/g' \
41+
-e 's/%%PG_VERSION%%/'"$srcVersion"'/g' \
42+
-e 's/%%PG_SHA256%%/'"$srcSha256"'/g' \
43+
"Dockerfile-$variant.template" > "$version/$variant/Dockerfile"
44+
45+
# TODO remove all this when 9.2 and 9.3 are EOL (2017-10-01 and 2018-10-01 -- from http://www.postgresql.org/support/versioning/)
46+
case "$version" in
47+
9.2|9.3)
48+
uuidConfigFlag='--with-ossp-uuid'
49+
sed -i 's/%%OSSP_UUID_ENV_VARS%%/ENV OSSP_UUID_VERSION '"$osspUuidVersion"'\nENV OSSP_UUID_SHA256 '"$osspUuidHash"'\n/' "$version/$variant/Dockerfile"
50+
sed -i $'/%%INSTALL_OSSP_UUID%%/ {r ossp-uuid.template\n d}' "$version/$variant/Dockerfile"
51+
52+
# configure: WARNING: unrecognized options: --enable-tap-tests
53+
sed -i '/--enable-tap-tests/d' "$version/$variant/Dockerfile"
54+
;;
55+
56+
*)
57+
uuidConfigFlag='--with-uuid=e2fs'
58+
sed -i '/%%OSSP_UUID_ENV_VARS%%/d' "$version/$variant/Dockerfile"
59+
sed -i '/%%INSTALL_OSSP_UUID%%/d' "$version/$variant/Dockerfile"
60+
;;
61+
esac
62+
sed -i 's/%%UUID_CONFIG_FLAG%%/'"$uuidConfigFlag"'/' "$version/$variant/Dockerfile"
3763
)
3864
travisEnv="\n - VERSION=$version VARIANT=$variant$travisEnv"
3965
done

0 commit comments

Comments
 (0)