-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add more PostgreSQL architectures #3397
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Diff:diff --git a/_bashbrew-arches b/_bashbrew-arches
index c64e340..058e0f7 100644
--- a/_bashbrew-arches
+++ b/_bashbrew-arches
@@ -1,24 +1,48 @@
postgres:9.2 @ amd64
+postgres:9.2 @ arm32v5
+postgres:9.2 @ arm32v7
+postgres:9.2 @ arm64v8
postgres:9.2 @ i386
postgres:9.2 @ ppc64le
+postgres:9.2 @ s390x
postgres:9.2-alpine @ amd64
postgres:9.3 @ amd64
+postgres:9.3 @ arm32v5
+postgres:9.3 @ arm32v7
+postgres:9.3 @ arm64v8
postgres:9.3 @ i386
postgres:9.3 @ ppc64le
+postgres:9.3 @ s390x
postgres:9.3-alpine @ amd64
postgres:9.4 @ amd64
+postgres:9.4 @ arm32v5
+postgres:9.4 @ arm32v7
+postgres:9.4 @ arm64v8
postgres:9.4 @ i386
postgres:9.4 @ ppc64le
+postgres:9.4 @ s390x
postgres:9.4-alpine @ amd64
postgres:9.5 @ amd64
+postgres:9.5 @ arm32v5
+postgres:9.5 @ arm32v7
+postgres:9.5 @ arm64v8
postgres:9.5 @ i386
postgres:9.5 @ ppc64le
+postgres:9.5 @ s390x
postgres:9.5-alpine @ amd64
postgres:10 @ amd64
+postgres:10 @ arm32v5
+postgres:10 @ arm32v7
+postgres:10 @ arm64v8
postgres:10 @ i386
postgres:10 @ ppc64le
+postgres:10 @ s390x
postgres:10-alpine @ amd64
postgres:alpine @ amd64
postgres:latest @ amd64
+postgres:latest @ arm32v5
+postgres:latest @ arm32v7
+postgres:latest @ arm64v8
postgres:latest @ i386
postgres:latest @ ppc64le
+postgres:latest @ s390x
diff --git a/postgres_10/Dockerfile b/postgres_10/Dockerfile
index 6afdca6..a5c68fd 100644
--- a/postgres_10/Dockerfile
+++ b/postgres_10/Dockerfile
@@ -15,7 +15,7 @@ RUN set -ex; \
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
# grab gosu for easy step-down from root
-ENV GOSU_VERSION 1.7
+ENV GOSU_VERSION 1.10
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
@@ -49,18 +49,73 @@ RUN set -ex; \
ENV PG_MAJOR 10
ENV PG_VERSION 10~beta4-1.pgdg90+1
-RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
-
-RUN apt-get update \
- && apt-get install -y postgresql-common \
- && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
- && apt-get install -y \
- postgresql-$PG_MAJOR=$PG_VERSION \
- && rm -rf /var/lib/apt/lists/*
+RUN set -ex; \
+ \
+ dpkgArch="$(dpkg --print-architecture)"; \
+ case "$dpkgArch" in \
+ amd64|i386|ppc64el) \
+# arches officialy built by upstream
+ echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ apt-get update; \
+ ;; \
+ *) \
+# we're on an architecture upstream doesn't officially build for
+# let's build binaries from their published source packages
+ echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ \
+ tempDir="$(mktemp -d)"; \
+ cd "$tempDir"; \
+ \
+ savedAptMark="$(apt-mark showmanual)"; \
+ \
+# build .deb files from upstream's source packages (which are verified by apt-get)
+ apt-get update; \
+ apt-get build-dep -y \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
+ apt-get source --compile \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+# we don't remove APT lists here because they get re-downloaded and removed later
+ \
+# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
+# (which is done after we install the built packages so we don't have to redownload any overlapping dependencies)
+ apt-mark showmanual | xargs apt-mark auto > /dev/null; \
+ apt-mark manual $savedAptMark; \
+ \
+# create a temporary local APT repo to install from (so that dependency resolution can be handled by APT, as it should be)
+ ls -lAFh; \
+ dpkg-scanpackages . > Packages; \
+ grep '^Package: ' Packages; \
+ echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list; \
+# work around the following APT issue by using "Acquire::GzipIndexes=false" (overriding "/etc/apt/apt.conf.d/docker-gzip-indexes")
+# Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+# ...
+# E: Failed to fetch store:/var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+ apt-get -o Acquire::GzipIndexes=false update; \
+ ;; \
+ esac; \
+ \
+ apt-get install -y postgresql-common; \
+ sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf; \
+ apt-get install -y \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ \
+ rm -rf /var/lib/apt/lists/*; \
+ \
+ if [ -n "$tempDir" ]; then \
+# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
+ apt-get purge -y --auto-remove; \
+ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
+ fi
# make the sample config easier to munge (and "correct by default")
-RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
- && ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
+RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
+ && ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/" \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
diff --git a/postgres_9.2/Dockerfile b/postgres_9.2/Dockerfile
index d42b5aa..e9ef7f2 100644
--- a/postgres_9.2/Dockerfile
+++ b/postgres_9.2/Dockerfile
@@ -15,7 +15,7 @@ RUN set -ex; \
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
# grab gosu for easy step-down from root
-ENV GOSU_VERSION 1.7
+ENV GOSU_VERSION 1.10
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
@@ -49,19 +49,74 @@ RUN set -ex; \
ENV PG_MAJOR 9.2
ENV PG_VERSION 9.2.23-1.pgdg80+1
-RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
-
-RUN apt-get update \
- && apt-get install -y postgresql-common \
- && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
- && apt-get install -y \
- postgresql-$PG_MAJOR=$PG_VERSION \
- postgresql-contrib-$PG_MAJOR=$PG_VERSION \
- && rm -rf /var/lib/apt/lists/*
+RUN set -ex; \
+ \
+ dpkgArch="$(dpkg --print-architecture)"; \
+ case "$dpkgArch" in \
+ amd64|i386|ppc64el) \
+# arches officialy built by upstream
+ echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ apt-get update; \
+ ;; \
+ *) \
+# we're on an architecture upstream doesn't officially build for
+# let's build binaries from their published source packages
+ echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ \
+ tempDir="$(mktemp -d)"; \
+ cd "$tempDir"; \
+ \
+ savedAptMark="$(apt-mark showmanual)"; \
+ \
+# build .deb files from upstream's source packages (which are verified by apt-get)
+ apt-get update; \
+ apt-get build-dep -y \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
+ apt-get source --compile \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+# we don't remove APT lists here because they get re-downloaded and removed later
+ \
+# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
+# (which is done after we install the built packages so we don't have to redownload any overlapping dependencies)
+ apt-mark showmanual | xargs apt-mark auto > /dev/null; \
+ apt-mark manual $savedAptMark; \
+ \
+# create a temporary local APT repo to install from (so that dependency resolution can be handled by APT, as it should be)
+ ls -lAFh; \
+ dpkg-scanpackages . > Packages; \
+ grep '^Package: ' Packages; \
+ echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list; \
+# work around the following APT issue by using "Acquire::GzipIndexes=false" (overriding "/etc/apt/apt.conf.d/docker-gzip-indexes")
+# Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+# ...
+# E: Failed to fetch store:/var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+ apt-get -o Acquire::GzipIndexes=false update; \
+ ;; \
+ esac; \
+ \
+ apt-get install -y postgresql-common; \
+ sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf; \
+ apt-get install -y \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ "postgresql-contrib-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ \
+ rm -rf /var/lib/apt/lists/*; \
+ \
+ if [ -n "$tempDir" ]; then \
+# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
+ apt-get purge -y --auto-remove; \
+ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
+ fi
# make the sample config easier to munge (and "correct by default")
-RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
- && ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
+RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
+ && ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/" \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
diff --git a/postgres_9.3/Dockerfile b/postgres_9.3/Dockerfile
index 7bfb84c..f05dbc5 100644
--- a/postgres_9.3/Dockerfile
+++ b/postgres_9.3/Dockerfile
@@ -15,7 +15,7 @@ RUN set -ex; \
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
# grab gosu for easy step-down from root
-ENV GOSU_VERSION 1.7
+ENV GOSU_VERSION 1.10
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
@@ -49,19 +49,74 @@ RUN set -ex; \
ENV PG_MAJOR 9.3
ENV PG_VERSION 9.3.19-1.pgdg80+1
-RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
-
-RUN apt-get update \
- && apt-get install -y postgresql-common \
- && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
- && apt-get install -y \
- postgresql-$PG_MAJOR=$PG_VERSION \
- postgresql-contrib-$PG_MAJOR=$PG_VERSION \
- && rm -rf /var/lib/apt/lists/*
+RUN set -ex; \
+ \
+ dpkgArch="$(dpkg --print-architecture)"; \
+ case "$dpkgArch" in \
+ amd64|i386|ppc64el) \
+# arches officialy built by upstream
+ echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ apt-get update; \
+ ;; \
+ *) \
+# we're on an architecture upstream doesn't officially build for
+# let's build binaries from their published source packages
+ echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ \
+ tempDir="$(mktemp -d)"; \
+ cd "$tempDir"; \
+ \
+ savedAptMark="$(apt-mark showmanual)"; \
+ \
+# build .deb files from upstream's source packages (which are verified by apt-get)
+ apt-get update; \
+ apt-get build-dep -y \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
+ apt-get source --compile \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+# we don't remove APT lists here because they get re-downloaded and removed later
+ \
+# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
+# (which is done after we install the built packages so we don't have to redownload any overlapping dependencies)
+ apt-mark showmanual | xargs apt-mark auto > /dev/null; \
+ apt-mark manual $savedAptMark; \
+ \
+# create a temporary local APT repo to install from (so that dependency resolution can be handled by APT, as it should be)
+ ls -lAFh; \
+ dpkg-scanpackages . > Packages; \
+ grep '^Package: ' Packages; \
+ echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list; \
+# work around the following APT issue by using "Acquire::GzipIndexes=false" (overriding "/etc/apt/apt.conf.d/docker-gzip-indexes")
+# Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+# ...
+# E: Failed to fetch store:/var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+ apt-get -o Acquire::GzipIndexes=false update; \
+ ;; \
+ esac; \
+ \
+ apt-get install -y postgresql-common; \
+ sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf; \
+ apt-get install -y \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ "postgresql-contrib-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ \
+ rm -rf /var/lib/apt/lists/*; \
+ \
+ if [ -n "$tempDir" ]; then \
+# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
+ apt-get purge -y --auto-remove; \
+ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
+ fi
# make the sample config easier to munge (and "correct by default")
-RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
- && ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
+RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
+ && ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/" \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
diff --git a/postgres_9.4/Dockerfile b/postgres_9.4/Dockerfile
index 40b2460..94dc674 100644
--- a/postgres_9.4/Dockerfile
+++ b/postgres_9.4/Dockerfile
@@ -15,7 +15,7 @@ RUN set -ex; \
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
# grab gosu for easy step-down from root
-ENV GOSU_VERSION 1.7
+ENV GOSU_VERSION 1.10
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
@@ -49,19 +49,74 @@ RUN set -ex; \
ENV PG_MAJOR 9.4
ENV PG_VERSION 9.4.14-1.pgdg80+1
-RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
-
-RUN apt-get update \
- && apt-get install -y postgresql-common \
- && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
- && apt-get install -y \
- postgresql-$PG_MAJOR=$PG_VERSION \
- postgresql-contrib-$PG_MAJOR=$PG_VERSION \
- && rm -rf /var/lib/apt/lists/*
+RUN set -ex; \
+ \
+ dpkgArch="$(dpkg --print-architecture)"; \
+ case "$dpkgArch" in \
+ amd64|i386|ppc64el) \
+# arches officialy built by upstream
+ echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ apt-get update; \
+ ;; \
+ *) \
+# we're on an architecture upstream doesn't officially build for
+# let's build binaries from their published source packages
+ echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ \
+ tempDir="$(mktemp -d)"; \
+ cd "$tempDir"; \
+ \
+ savedAptMark="$(apt-mark showmanual)"; \
+ \
+# build .deb files from upstream's source packages (which are verified by apt-get)
+ apt-get update; \
+ apt-get build-dep -y \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
+ apt-get source --compile \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+# we don't remove APT lists here because they get re-downloaded and removed later
+ \
+# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
+# (which is done after we install the built packages so we don't have to redownload any overlapping dependencies)
+ apt-mark showmanual | xargs apt-mark auto > /dev/null; \
+ apt-mark manual $savedAptMark; \
+ \
+# create a temporary local APT repo to install from (so that dependency resolution can be handled by APT, as it should be)
+ ls -lAFh; \
+ dpkg-scanpackages . > Packages; \
+ grep '^Package: ' Packages; \
+ echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list; \
+# work around the following APT issue by using "Acquire::GzipIndexes=false" (overriding "/etc/apt/apt.conf.d/docker-gzip-indexes")
+# Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+# ...
+# E: Failed to fetch store:/var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+ apt-get -o Acquire::GzipIndexes=false update; \
+ ;; \
+ esac; \
+ \
+ apt-get install -y postgresql-common; \
+ sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf; \
+ apt-get install -y \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ "postgresql-contrib-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ \
+ rm -rf /var/lib/apt/lists/*; \
+ \
+ if [ -n "$tempDir" ]; then \
+# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
+ apt-get purge -y --auto-remove; \
+ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
+ fi
# make the sample config easier to munge (and "correct by default")
-RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
- && ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
+RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
+ && ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/" \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
diff --git a/postgres_9.5/Dockerfile b/postgres_9.5/Dockerfile
index da5e28e..d67bcbf 100644
--- a/postgres_9.5/Dockerfile
+++ b/postgres_9.5/Dockerfile
@@ -15,7 +15,7 @@ RUN set -ex; \
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
# grab gosu for easy step-down from root
-ENV GOSU_VERSION 1.7
+ENV GOSU_VERSION 1.10
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
@@ -49,19 +49,74 @@ RUN set -ex; \
ENV PG_MAJOR 9.5
ENV PG_VERSION 9.5.9-1.pgdg80+1
-RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
-
-RUN apt-get update \
- && apt-get install -y postgresql-common \
- && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
- && apt-get install -y \
- postgresql-$PG_MAJOR=$PG_VERSION \
- postgresql-contrib-$PG_MAJOR=$PG_VERSION \
- && rm -rf /var/lib/apt/lists/*
+RUN set -ex; \
+ \
+ dpkgArch="$(dpkg --print-architecture)"; \
+ case "$dpkgArch" in \
+ amd64|i386|ppc64el) \
+# arches officialy built by upstream
+ echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ apt-get update; \
+ ;; \
+ *) \
+# we're on an architecture upstream doesn't officially build for
+# let's build binaries from their published source packages
+ echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ \
+ tempDir="$(mktemp -d)"; \
+ cd "$tempDir"; \
+ \
+ savedAptMark="$(apt-mark showmanual)"; \
+ \
+# build .deb files from upstream's source packages (which are verified by apt-get)
+ apt-get update; \
+ apt-get build-dep -y \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
+ apt-get source --compile \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+# we don't remove APT lists here because they get re-downloaded and removed later
+ \
+# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
+# (which is done after we install the built packages so we don't have to redownload any overlapping dependencies)
+ apt-mark showmanual | xargs apt-mark auto > /dev/null; \
+ apt-mark manual $savedAptMark; \
+ \
+# create a temporary local APT repo to install from (so that dependency resolution can be handled by APT, as it should be)
+ ls -lAFh; \
+ dpkg-scanpackages . > Packages; \
+ grep '^Package: ' Packages; \
+ echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list; \
+# work around the following APT issue by using "Acquire::GzipIndexes=false" (overriding "/etc/apt/apt.conf.d/docker-gzip-indexes")
+# Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+# ...
+# E: Failed to fetch store:/var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+ apt-get -o Acquire::GzipIndexes=false update; \
+ ;; \
+ esac; \
+ \
+ apt-get install -y postgresql-common; \
+ sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf; \
+ apt-get install -y \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ "postgresql-contrib-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ \
+ rm -rf /var/lib/apt/lists/*; \
+ \
+ if [ -n "$tempDir" ]; then \
+# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
+ apt-get purge -y --auto-remove; \
+ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
+ fi
# make the sample config easier to munge (and "correct by default")
-RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
- && ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
+RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
+ && ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/" \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
diff --git a/postgres_latest/Dockerfile b/postgres_latest/Dockerfile
index 5157868..c20ea32 100644
--- a/postgres_latest/Dockerfile
+++ b/postgres_latest/Dockerfile
@@ -15,7 +15,7 @@ RUN set -ex; \
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
# grab gosu for easy step-down from root
-ENV GOSU_VERSION 1.7
+ENV GOSU_VERSION 1.10
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
@@ -49,19 +49,74 @@ RUN set -ex; \
ENV PG_MAJOR 9.6
ENV PG_VERSION 9.6.5-1.pgdg80+1
-RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
-
-RUN apt-get update \
- && apt-get install -y postgresql-common \
- && sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
- && apt-get install -y \
- postgresql-$PG_MAJOR=$PG_VERSION \
- postgresql-contrib-$PG_MAJOR=$PG_VERSION \
- && rm -rf /var/lib/apt/lists/*
+RUN set -ex; \
+ \
+ dpkgArch="$(dpkg --print-architecture)"; \
+ case "$dpkgArch" in \
+ amd64|i386|ppc64el) \
+# arches officialy built by upstream
+ echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ apt-get update; \
+ ;; \
+ *) \
+# we're on an architecture upstream doesn't officially build for
+# let's build binaries from their published source packages
+ echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
+ \
+ tempDir="$(mktemp -d)"; \
+ cd "$tempDir"; \
+ \
+ savedAptMark="$(apt-mark showmanual)"; \
+ \
+# build .deb files from upstream's source packages (which are verified by apt-get)
+ apt-get update; \
+ apt-get build-dep -y \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
+ apt-get source --compile \
+ postgresql-common pgdg-keyring \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ ; \
+# we don't remove APT lists here because they get re-downloaded and removed later
+ \
+# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
+# (which is done after we install the built packages so we don't have to redownload any overlapping dependencies)
+ apt-mark showmanual | xargs apt-mark auto > /dev/null; \
+ apt-mark manual $savedAptMark; \
+ \
+# create a temporary local APT repo to install from (so that dependency resolution can be handled by APT, as it should be)
+ ls -lAFh; \
+ dpkg-scanpackages . > Packages; \
+ grep '^Package: ' Packages; \
+ echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list; \
+# work around the following APT issue by using "Acquire::GzipIndexes=false" (overriding "/etc/apt/apt.conf.d/docker-gzip-indexes")
+# Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+# ...
+# E: Failed to fetch store:/var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
+ apt-get -o Acquire::GzipIndexes=false update; \
+ ;; \
+ esac; \
+ \
+ apt-get install -y postgresql-common; \
+ sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf; \
+ apt-get install -y \
+ "postgresql-$PG_MAJOR=$PG_VERSION" \
+ "postgresql-contrib-$PG_MAJOR=$PG_VERSION" \
+ ; \
+ \
+ rm -rf /var/lib/apt/lists/*; \
+ \
+ if [ -n "$tempDir" ]; then \
+# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
+ apt-get purge -y --auto-remove; \
+ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
+ fi
# make the sample config easier to munge (and "correct by default")
-RUN mv -v /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample /usr/share/postgresql/ \
- && ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
+RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
+ && ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/" \
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql |
Build test of #3397; ba2d042 ( $ bashbrew build postgres:10-beta4
Building bashbrew/cache:464f8c244c89eddbf6c7f742b731bfdc0812579be7d36680c59c50322fcb5cf3 (postgres:10-beta4)
Tagging postgres:10-beta4
Tagging postgres:10
$ test/run.sh postgres:10-beta4
testing postgres:10-beta4
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6]....passed
'postgres-initdb' [6/6]....passed
$ bashbrew build postgres:10-beta4-alpine
Using bashbrew/cache:dcf95fc3a631e07670e90e9e9ab4f6fb71a242a7077cd740a7fc1459a88053d7 (postgres:10-beta4-alpine)
Tagging postgres:10-beta4-alpine
Tagging postgres:10-alpine
$ test/run.sh postgres:10-beta4-alpine
testing postgres:10-beta4-alpine
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6]....passed
'postgres-initdb' [6/6]....passed
$ bashbrew build postgres:9.6.5
Building bashbrew/cache:d823325fc1dcbf8ba60d49752460b86cf30a7458766a4293e769b3accffde5a2 (postgres:9.6.5)
Tagging postgres:9.6.5
Tagging postgres:9.6
Tagging postgres:9
Tagging postgres:latest
$ test/run.sh postgres:9.6.5
testing postgres:9.6.5
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6].....passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.6.5-alpine
Using bashbrew/cache:50f6ac49138913fe8c4d4fa32f00dcb02c3b568bab47c4d20b1455abe0aea6b7 (postgres:9.6.5-alpine)
Tagging postgres:9.6.5-alpine
Tagging postgres:9.6-alpine
Tagging postgres:9-alpine
Tagging postgres:alpine
$ test/run.sh postgres:9.6.5-alpine
testing postgres:9.6.5-alpine
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6].....passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.5.9
Building bashbrew/cache:8d567fee16f81f3466c128c7a5661561994de41164cec61ff7fdf2c2ed21926c (postgres:9.5.9)
Tagging postgres:9.5.9
Tagging postgres:9.5
$ test/run.sh postgres:9.5.9
testing postgres:9.5.9
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6].....passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.5.9-alpine
Using bashbrew/cache:e8a128630c3d109906ebf26d58a59f3d5a5fd9595316bcadcd9550d8bdafb7fe (postgres:9.5.9-alpine)
Tagging postgres:9.5.9-alpine
Tagging postgres:9.5-alpine
$ test/run.sh postgres:9.5.9-alpine
testing postgres:9.5.9-alpine
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6].....passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.4.14
Building bashbrew/cache:234bd4f770114d061bde8fce7b5849dcc22fb8ac0c01ba671ac9ff067335eb1f (postgres:9.4.14)
Tagging postgres:9.4.14
Tagging postgres:9.4
$ test/run.sh postgres:9.4.14
testing postgres:9.4.14
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6].....passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.4.14-alpine
Using bashbrew/cache:d39d33f86248c4fb8a1638176964111c03603b23b11520d3f351b2f5f5fc82b9 (postgres:9.4.14-alpine)
Tagging postgres:9.4.14-alpine
Tagging postgres:9.4-alpine
$ test/run.sh postgres:9.4.14-alpine
testing postgres:9.4.14-alpine
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6].....passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.3.19
Building bashbrew/cache:4c4556fb8b180a2066f52e2984933174f6a6c2e9729f4883e2a90dd102fc148b (postgres:9.3.19)
Tagging postgres:9.3.19
Tagging postgres:9.3
$ test/run.sh postgres:9.3.19
testing postgres:9.3.19
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6]......passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.3.19-alpine
Using bashbrew/cache:0917403c2996377ddba3d9c273fcc8de709c7bfd949e9581993db16fa6bef32f (postgres:9.3.19-alpine)
Tagging postgres:9.3.19-alpine
Tagging postgres:9.3-alpine
$ test/run.sh postgres:9.3.19-alpine
testing postgres:9.3.19-alpine
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6].....passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.2.23
Building bashbrew/cache:039b7efcb34f829e5f7e7323bbd8894a1693ba2389710ba3a026275c0e29f86d (postgres:9.2.23)
Tagging postgres:9.2.23
Tagging postgres:9.2
$ test/run.sh postgres:9.2.23
testing postgres:9.2.23
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6].....passed
'postgres-initdb' [6/6].....passed
$ bashbrew build postgres:9.2.23-alpine
Using bashbrew/cache:46b7495a613c654a87f3a1b57d79c8cfde9d1deabf2bb569b4d14f018992b450 (postgres:9.2.23-alpine)
Tagging postgres:9.2.23-alpine
Tagging postgres:9.2-alpine
$ test/run.sh postgres:9.2.23-alpine
testing postgres:9.2.23-alpine
'utc' [1/6]...passed
'cve-2014--shellshock' [2/6]...passed
'no-hard-coded-passwords' [3/6]...passed
'override-cmd' [4/6]...passed
'postgres-basics' [5/6]....passed
'postgres-initdb' [6/6].....passed
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See docker-library/postgres#330.