Skip to content

Add ossp uuid to the alpine 9.2 and 9.3 images #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions 9.2/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ ENV PG_MAJOR 9.2
ENV PG_VERSION 9.2.20
ENV PG_SHA256 0b8abdae8400cabea5587a726003c9dd71c73c049bdae523abc35f9312dd8f26

ENV OSSP_UUID_VERSION 1.6.2
ENV OSSP_UUID_SHA256 11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0

RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
Expand All @@ -36,6 +39,7 @@ RUN set -ex \
\
&& apk add --no-cache --virtual .build-deps \
bison \
coreutils \
flex \
gcc \
# krb5-dev \
Expand All @@ -54,6 +58,26 @@ RUN set -ex \
util-linux-dev \
zlib-dev \
\
# install OSSP uuid (http://www.ossp.org/pkg/lib/uuid/)
# see https://github.com/docker-library/postgres/pull/255 for more details
&& wget -O uuid.tar.gz "https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-$OSSP_UUID_VERSION.tar.gz" \
&& echo "$OSSP_UUID_SHA256 *uuid.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/ossp-uuid \
&& tar \
--extract \
--file uuid.tar.gz \
--directory /usr/src/ossp-uuid \
--strip-components 1 \
&& rm uuid.tar.gz \
&& ( \
cd /usr/src/ossp-uuid \
&& ./configure \
--prefix=/usr/local \
&& make -j "$(nproc)" \
&& make install \
) \
&& rm -rf /usr/src/ossp-uuid \
\
&& cd /usr/src/postgresql \
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
Expand All @@ -67,15 +91,16 @@ RUN set -ex \
# --enable-nls \
--enable-integer-datetimes \
--enable-thread-safety \
--enable-tap-tests \
# skip debugging info -- we want tiny size instead
# --enable-debug \
--disable-rpath \
--with-uuid=e2fs \
--with-ossp-uuid \
--with-gnu-ld \
--with-pgport=5432 \
--with-system-tzdata=/usr/share/zoneinfo \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
\
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
# --with-krb5 \
Expand All @@ -88,7 +113,7 @@ RUN set -ex \
--with-openssl \
--with-libxml \
--with-libxslt \
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
&& make -j "$(nproc)" world \
&& make install-world \
&& make -C contrib install \
\
Expand Down
31 changes: 28 additions & 3 deletions 9.3/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ ENV PG_MAJOR 9.3
ENV PG_VERSION 9.3.16
ENV PG_SHA256 845f5e4ac8cf026b6a77c5a180a2fe869f51e9d06acf8d0365b05505a2c66873

ENV OSSP_UUID_VERSION 1.6.2
ENV OSSP_UUID_SHA256 11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0

RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
Expand All @@ -36,6 +39,7 @@ RUN set -ex \
\
&& apk add --no-cache --virtual .build-deps \
bison \
coreutils \
flex \
gcc \
# krb5-dev \
Expand All @@ -54,6 +58,26 @@ RUN set -ex \
util-linux-dev \
zlib-dev \
\
# install OSSP uuid (http://www.ossp.org/pkg/lib/uuid/)
# see https://github.com/docker-library/postgres/pull/255 for more details
&& wget -O uuid.tar.gz "https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-$OSSP_UUID_VERSION.tar.gz" \
&& echo "$OSSP_UUID_SHA256 *uuid.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/ossp-uuid \
&& tar \
--extract \
--file uuid.tar.gz \
--directory /usr/src/ossp-uuid \
--strip-components 1 \
&& rm uuid.tar.gz \
&& ( \
cd /usr/src/ossp-uuid \
&& ./configure \
--prefix=/usr/local \
&& make -j "$(nproc)" \
&& make install \
) \
&& rm -rf /usr/src/ossp-uuid \
\
&& cd /usr/src/postgresql \
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
Expand All @@ -67,15 +91,16 @@ RUN set -ex \
# --enable-nls \
--enable-integer-datetimes \
--enable-thread-safety \
--enable-tap-tests \
# skip debugging info -- we want tiny size instead
# --enable-debug \
--disable-rpath \
--with-uuid=e2fs \
--with-ossp-uuid \
--with-gnu-ld \
--with-pgport=5432 \
--with-system-tzdata=/usr/share/zoneinfo \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
\
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
# --with-krb5 \
Expand All @@ -88,7 +113,7 @@ RUN set -ex \
--with-openssl \
--with-libxml \
--with-libxslt \
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
&& make -j "$(nproc)" world \
&& make install-world \
&& make -C contrib install \
\
Expand Down
5 changes: 4 additions & 1 deletion 9.4/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN set -ex \
\
&& apk add --no-cache --virtual .build-deps \
bison \
coreutils \
flex \
gcc \
# krb5-dev \
Expand Down Expand Up @@ -76,6 +77,8 @@ RUN set -ex \
--with-pgport=5432 \
--with-system-tzdata=/usr/share/zoneinfo \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
\
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
# --with-krb5 \
Expand All @@ -88,7 +91,7 @@ RUN set -ex \
--with-openssl \
--with-libxml \
--with-libxslt \
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
&& make -j "$(nproc)" world \
&& make install-world \
&& make -C contrib install \
\
Expand Down
5 changes: 4 additions & 1 deletion 9.5/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN set -ex \
\
&& apk add --no-cache --virtual .build-deps \
bison \
coreutils \
flex \
gcc \
# krb5-dev \
Expand Down Expand Up @@ -76,6 +77,8 @@ RUN set -ex \
--with-pgport=5432 \
--with-system-tzdata=/usr/share/zoneinfo \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
\
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
# --with-krb5 \
Expand All @@ -88,7 +91,7 @@ RUN set -ex \
--with-openssl \
--with-libxml \
--with-libxslt \
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
&& make -j "$(nproc)" world \
&& make install-world \
&& make -C contrib install \
\
Expand Down
5 changes: 4 additions & 1 deletion 9.6/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN set -ex \
\
&& apk add --no-cache --virtual .build-deps \
bison \
coreutils \
flex \
gcc \
# krb5-dev \
Expand Down Expand Up @@ -76,6 +77,8 @@ RUN set -ex \
--with-pgport=5432 \
--with-system-tzdata=/usr/share/zoneinfo \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
\
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
# --with-krb5 \
Expand All @@ -88,7 +91,7 @@ RUN set -ex \
--with-openssl \
--with-libxml \
--with-libxslt \
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
&& make -j "$(nproc)" world \
&& make install-world \
&& make -C contrib install \
\
Expand Down
9 changes: 7 additions & 2 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ENV PG_MAJOR %%PG_MAJOR%%
ENV PG_VERSION %%PG_VERSION%%
ENV PG_SHA256 %%PG_SHA256%%

%%OSSP_UUID_ENV_VARS%%
RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
Expand All @@ -36,6 +37,7 @@ RUN set -ex \
\
&& apk add --no-cache --virtual .build-deps \
bison \
coreutils \
flex \
gcc \
# krb5-dev \
Expand All @@ -54,6 +56,7 @@ RUN set -ex \
util-linux-dev \
zlib-dev \
\
%%INSTALL_OSSP_UUID%%
&& cd /usr/src/postgresql \
# update "DEFAULT_PGSOCKET_DIR" to "/var/run/postgresql" (matching Debian)
# see https://anonscm.debian.org/git/pkg-postgresql/postgresql.git/tree/debian/patches/51-default-sockets-in-var.patch?id=8b539fcb3e093a521c095e70bdfa76887217b89f
Expand All @@ -71,11 +74,13 @@ RUN set -ex \
# skip debugging info -- we want tiny size instead
# --enable-debug \
--disable-rpath \
--with-uuid=e2fs \
%%UUID_CONFIG_FLAG%% \
--with-gnu-ld \
--with-pgport=5432 \
--with-system-tzdata=/usr/share/zoneinfo \
--prefix=/usr/local \
--with-includes=/usr/local/include \
--with-libraries=/usr/local/lib \
\
# these make our image abnormally large (at least 100MB larger), which seems uncouth for an "Alpine" (ie, "small") variant :)
# --with-krb5 \
Expand All @@ -88,7 +93,7 @@ RUN set -ex \
--with-openssl \
--with-libxml \
--with-libxslt \
&& make -j "$(getconf _NPROCESSORS_ONLN)" world \
&& make -j "$(nproc)" world \
&& make install-world \
&& make -C contrib install \
\
Expand Down
20 changes: 20 additions & 0 deletions ossp-uuid.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# install OSSP uuid (http://www.ossp.org/pkg/lib/uuid/)
# see https://github.com/docker-library/postgres/pull/255 for more details
&& wget -O uuid.tar.gz "https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/uuid-$OSSP_UUID_VERSION.tar.gz" \
&& echo "$OSSP_UUID_SHA256 *uuid.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/ossp-uuid \
&& tar \
--extract \
--file uuid.tar.gz \
--directory /usr/src/ossp-uuid \
--strip-components 1 \
&& rm uuid.tar.gz \
&& ( \
cd /usr/src/ossp-uuid \
&& ./configure \
--prefix=/usr/local \
&& make -j "$(nproc)" \
&& make install \
) \
&& rm -rf /usr/src/ossp-uuid \
\
28 changes: 27 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ versions=( "${versions[@]%/}" )
packagesBase='http://apt.postgresql.org/pub/repos/apt/dists/jessie-pgdg'
mainList="$(curl -fsSL "$packagesBase/main/binary-amd64/Packages.bz2" | bunzip2)"

# https://www.mirrorservice.org/sites/ftp.ossp.org/pkg/lib/uuid/?C=M;O=D
osspUuidVersion='1.6.2'
osspUuidHash='11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0'

travisEnv=
for version in "${versions[@]}"; do
versionList="$(echo "$mainList"; curl -fsSL "$packagesBase/$version/binary-amd64/Packages.bz2" | bunzip2)"
Expand All @@ -33,7 +37,29 @@ for version in "${versions[@]}"; do
set -x
cp docker-entrypoint.sh "$version/$variant/"
sed -i 's/gosu/su-exec/g' "$version/$variant/docker-entrypoint.sh"
sed 's/%%PG_MAJOR%%/'"$version"'/g; s/%%PG_VERSION%%/'"$srcVersion"'/g; s/%%PG_SHA256%%/'"$srcSha256"'/g' Dockerfile-$variant.template > "$version/$variant/Dockerfile"
sed -e 's/%%PG_MAJOR%%/'"$version"'/g' \
-e 's/%%PG_VERSION%%/'"$srcVersion"'/g' \
-e 's/%%PG_SHA256%%/'"$srcSha256"'/g' \
"Dockerfile-$variant.template" > "$version/$variant/Dockerfile"

# 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/)
case "$version" in
9.2|9.3)
uuidConfigFlag='--with-ossp-uuid'
sed -i 's/%%OSSP_UUID_ENV_VARS%%/ENV OSSP_UUID_VERSION '"$osspUuidVersion"'\nENV OSSP_UUID_SHA256 '"$osspUuidHash"'\n/' "$version/$variant/Dockerfile"
sed -i $'/%%INSTALL_OSSP_UUID%%/ {r ossp-uuid.template\n d}' "$version/$variant/Dockerfile"

# configure: WARNING: unrecognized options: --enable-tap-tests
sed -i '/--enable-tap-tests/d' "$version/$variant/Dockerfile"
;;

*)
uuidConfigFlag='--with-uuid=e2fs'
sed -i '/%%OSSP_UUID_ENV_VARS%%/d' "$version/$variant/Dockerfile"
sed -i '/%%INSTALL_OSSP_UUID%%/d' "$version/$variant/Dockerfile"
;;
esac
sed -i 's/%%UUID_CONFIG_FLAG%%/'"$uuidConfigFlag"'/' "$version/$variant/Dockerfile"
)
travisEnv="\n - VERSION=$version VARIANT=$variant$travisEnv"
done
Expand Down