You've already forked postgres
mirror of
https://github.com/docker-library/postgres.git
synced 2025-07-28 10:42:06 +03:00
Use "apt-get source --compile" to build for Debian architectures upstream doesn't
This commit is contained in:
21
.travis.yml
21
.travis.yml
@ -3,16 +3,22 @@ services: docker
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
- VERSION=9.6
|
- VERSION=9.6
|
||||||
|
- VERSION=9.6 FORCE_DEB_BUILD=1
|
||||||
- VERSION=9.6 VARIANT=alpine
|
- VERSION=9.6 VARIANT=alpine
|
||||||
- VERSION=9.5
|
- VERSION=9.5
|
||||||
|
- VERSION=9.5 FORCE_DEB_BUILD=1
|
||||||
- VERSION=9.5 VARIANT=alpine
|
- VERSION=9.5 VARIANT=alpine
|
||||||
- VERSION=9.4
|
- VERSION=9.4
|
||||||
|
- VERSION=9.4 FORCE_DEB_BUILD=1
|
||||||
- VERSION=9.4 VARIANT=alpine
|
- VERSION=9.4 VARIANT=alpine
|
||||||
- VERSION=9.3
|
- VERSION=9.3
|
||||||
|
- VERSION=9.3 FORCE_DEB_BUILD=1
|
||||||
- VERSION=9.3 VARIANT=alpine
|
- VERSION=9.3 VARIANT=alpine
|
||||||
- VERSION=9.2
|
- VERSION=9.2
|
||||||
|
- VERSION=9.2 FORCE_DEB_BUILD=1
|
||||||
- VERSION=9.2 VARIANT=alpine
|
- VERSION=9.2 VARIANT=alpine
|
||||||
- VERSION=10
|
- VERSION=10
|
||||||
|
- VERSION=10 FORCE_DEB_BUILD=1
|
||||||
- VERSION=10 VARIANT=alpine
|
- VERSION=10 VARIANT=alpine
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@ -24,8 +30,19 @@ before_script:
|
|||||||
- image="postgres:${VERSION}${VARIANT:+-${VARIANT}}"
|
- image="postgres:${VERSION}${VARIANT:+-${VARIANT}}"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- travis_retry docker build -t "$image" .
|
- |
|
||||||
- ~/official-images/test/run.sh "$image"
|
(
|
||||||
|
set -Eeuo pipefail
|
||||||
|
set -x
|
||||||
|
if [ -n "${FORCE_DEB_BUILD:+x}" ]; then
|
||||||
|
[ "$(dpkg --print-architecture)" = 'amd64' ]
|
||||||
|
grep -qE 'amd64[|]' Dockerfile
|
||||||
|
sed -ri -e 's/amd64[|]//g' Dockerfile
|
||||||
|
! grep -qE 'amd64[|]' Dockerfile
|
||||||
|
fi
|
||||||
|
travis_retry docker build -t "$image" .
|
||||||
|
~/official-images/test/run.sh "$image"
|
||||||
|
)
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- docker images
|
- docker images
|
||||||
|
@ -15,7 +15,7 @@ RUN set -ex; \
|
|||||||
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
# grab gosu for easy step-down from root
|
||||||
ENV GOSU_VERSION 1.7
|
ENV GOSU_VERSION 1.10
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
|
&& 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)" \
|
&& 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_MAJOR 10
|
||||||
ENV PG_VERSION 10~beta3-1.pgdg90+1
|
ENV PG_VERSION 10~beta3-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 set -ex; \
|
||||||
|
\
|
||||||
RUN apt-get update \
|
dpkgArch="$(dpkg --print-architecture)"; \
|
||||||
&& apt-get install -y postgresql-common \
|
case "$dpkgArch" in \
|
||||||
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
amd64|i386|ppc64el) \
|
||||||
&& apt-get install -y \
|
# arches officialy built by upstream
|
||||||
postgresql-$PG_MAJOR=$PG_VERSION \
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
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")
|
# 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/ \
|
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
|
||||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
&& 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
|
&& 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
|
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
||||||
|
@ -15,7 +15,7 @@ RUN set -ex; \
|
|||||||
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
# grab gosu for easy step-down from root
|
||||||
ENV GOSU_VERSION 1.7
|
ENV GOSU_VERSION 1.10
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
|
&& 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)" \
|
&& 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_MAJOR 9.2
|
||||||
ENV PG_VERSION 9.2.22-1.pgdg80+1
|
ENV PG_VERSION 9.2.22-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 set -ex; \
|
||||||
|
\
|
||||||
RUN apt-get update \
|
dpkgArch="$(dpkg --print-architecture)"; \
|
||||||
&& apt-get install -y postgresql-common \
|
case "$dpkgArch" in \
|
||||||
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
amd64|i386|ppc64el) \
|
||||||
&& apt-get install -y \
|
# arches officialy built by upstream
|
||||||
postgresql-$PG_MAJOR=$PG_VERSION \
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
|
||||||
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
apt-get update; \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
;; \
|
||||||
|
*) \
|
||||||
|
# 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")
|
# 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/ \
|
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
|
||||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
&& 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
|
&& 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
|
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
||||||
|
@ -15,7 +15,7 @@ RUN set -ex; \
|
|||||||
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
# grab gosu for easy step-down from root
|
||||||
ENV GOSU_VERSION 1.7
|
ENV GOSU_VERSION 1.10
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
|
&& 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)" \
|
&& 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_MAJOR 9.3
|
||||||
ENV PG_VERSION 9.3.18-1.pgdg80+1
|
ENV PG_VERSION 9.3.18-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 set -ex; \
|
||||||
|
\
|
||||||
RUN apt-get update \
|
dpkgArch="$(dpkg --print-architecture)"; \
|
||||||
&& apt-get install -y postgresql-common \
|
case "$dpkgArch" in \
|
||||||
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
amd64|i386|ppc64el) \
|
||||||
&& apt-get install -y \
|
# arches officialy built by upstream
|
||||||
postgresql-$PG_MAJOR=$PG_VERSION \
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
|
||||||
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
apt-get update; \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
;; \
|
||||||
|
*) \
|
||||||
|
# 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")
|
# 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/ \
|
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
|
||||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
&& 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
|
&& 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
|
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
||||||
|
@ -15,7 +15,7 @@ RUN set -ex; \
|
|||||||
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
# grab gosu for easy step-down from root
|
||||||
ENV GOSU_VERSION 1.7
|
ENV GOSU_VERSION 1.10
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
|
&& 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)" \
|
&& 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_MAJOR 9.4
|
||||||
ENV PG_VERSION 9.4.13-1.pgdg80+1
|
ENV PG_VERSION 9.4.13-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 set -ex; \
|
||||||
|
\
|
||||||
RUN apt-get update \
|
dpkgArch="$(dpkg --print-architecture)"; \
|
||||||
&& apt-get install -y postgresql-common \
|
case "$dpkgArch" in \
|
||||||
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
amd64|i386|ppc64el) \
|
||||||
&& apt-get install -y \
|
# arches officialy built by upstream
|
||||||
postgresql-$PG_MAJOR=$PG_VERSION \
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
|
||||||
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
apt-get update; \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
;; \
|
||||||
|
*) \
|
||||||
|
# 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")
|
# 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/ \
|
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
|
||||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
&& 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
|
&& 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
|
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
||||||
|
@ -15,7 +15,7 @@ RUN set -ex; \
|
|||||||
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
# grab gosu for easy step-down from root
|
||||||
ENV GOSU_VERSION 1.7
|
ENV GOSU_VERSION 1.10
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
|
&& 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)" \
|
&& 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_MAJOR 9.5
|
||||||
ENV PG_VERSION 9.5.8-1.pgdg80+1
|
ENV PG_VERSION 9.5.8-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 set -ex; \
|
||||||
|
\
|
||||||
RUN apt-get update \
|
dpkgArch="$(dpkg --print-architecture)"; \
|
||||||
&& apt-get install -y postgresql-common \
|
case "$dpkgArch" in \
|
||||||
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
amd64|i386|ppc64el) \
|
||||||
&& apt-get install -y \
|
# arches officialy built by upstream
|
||||||
postgresql-$PG_MAJOR=$PG_VERSION \
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
|
||||||
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
apt-get update; \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
;; \
|
||||||
|
*) \
|
||||||
|
# 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")
|
# 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/ \
|
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
|
||||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
&& 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
|
&& 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
|
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
||||||
|
@ -15,7 +15,7 @@ RUN set -ex; \
|
|||||||
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
# grab gosu for easy step-down from root
|
||||||
ENV GOSU_VERSION 1.7
|
ENV GOSU_VERSION 1.10
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
|
&& 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)" \
|
&& 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_MAJOR 9.6
|
||||||
ENV PG_VERSION 9.6.4-1.pgdg80+1
|
ENV PG_VERSION 9.6.4-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 set -ex; \
|
||||||
|
\
|
||||||
RUN apt-get update \
|
dpkgArch="$(dpkg --print-architecture)"; \
|
||||||
&& apt-get install -y postgresql-common \
|
case "$dpkgArch" in \
|
||||||
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
amd64|i386|ppc64el) \
|
||||||
&& apt-get install -y \
|
# arches officialy built by upstream
|
||||||
postgresql-$PG_MAJOR=$PG_VERSION \
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
|
||||||
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
apt-get update; \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
;; \
|
||||||
|
*) \
|
||||||
|
# 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")
|
# 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/ \
|
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
|
||||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
&& 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
|
&& 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
|
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
||||||
|
@ -15,7 +15,7 @@ RUN set -ex; \
|
|||||||
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
RUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres
|
||||||
|
|
||||||
# grab gosu for easy step-down from root
|
# grab gosu for easy step-down from root
|
||||||
ENV GOSU_VERSION 1.7
|
ENV GOSU_VERSION 1.10
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
|
&& 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)" \
|
&& 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 %%PG_MAJOR%%
|
ENV PG_MAJOR %%PG_MAJOR%%
|
||||||
ENV PG_VERSION %%PG_VERSION%%
|
ENV PG_VERSION %%PG_VERSION%%
|
||||||
|
|
||||||
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ %%DEBIAN_SUITE%%-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
|
RUN set -ex; \
|
||||||
|
\
|
||||||
RUN apt-get update \
|
dpkgArch="$(dpkg --print-architecture)"; \
|
||||||
&& apt-get install -y postgresql-common \
|
case "$dpkgArch" in \
|
||||||
&& sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf \
|
%%ARCH_LIST%%) \
|
||||||
&& apt-get install -y \
|
# arches officialy built by upstream
|
||||||
postgresql-$PG_MAJOR=$PG_VERSION \
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ %%DEBIAN_SUITE%%-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
|
||||||
postgresql-contrib-$PG_MAJOR=$PG_VERSION \
|
apt-get update; \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
;; \
|
||||||
|
*) \
|
||||||
|
# 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/ %%DEBIAN_SUITE%%-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")
|
# 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/ \
|
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
|
||||||
&& ln -sv ../postgresql.conf.sample /usr/share/postgresql/$PG_MAJOR/ \
|
&& 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
|
&& 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
|
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
|
||||||
|
@ -85,18 +85,12 @@ for version in "${versions[@]}"; do
|
|||||||
)
|
)
|
||||||
|
|
||||||
versionParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
|
versionParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
|
||||||
versionArches=()
|
versionArches="${parentRepoToArches[$versionParent]}"
|
||||||
# http://apt.postgresql.org/pub/repos/apt/dists/jessie-pgdg/main/
|
|
||||||
for arch in amd64 i386 ppc64le; do
|
|
||||||
if [[ " ${parentRepoToArches[$versionParent]} " =~ " $arch " ]]; then
|
|
||||||
versionArches+=( "$arch" )
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
cat <<-EOE
|
cat <<-EOE
|
||||||
Tags: $(join ', ' "${versionAliases[@]}")
|
Tags: $(join ', ' "${versionAliases[@]}")
|
||||||
Architectures: $(join ', ' "${versionArches[@]}")
|
Architectures: $(join ', ' $versionArches)
|
||||||
GitCommit: $commit
|
GitCommit: $commit
|
||||||
Directory: $version
|
Directory: $version
|
||||||
EOE
|
EOE
|
||||||
|
@ -32,13 +32,16 @@ packagesBase='http://apt.postgresql.org/pub/repos/apt/dists/'
|
|||||||
osspUuidVersion='1.6.2'
|
osspUuidVersion='1.6.2'
|
||||||
osspUuidHash='11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0'
|
osspUuidHash='11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0'
|
||||||
|
|
||||||
declare -A suitePackageList
|
declare -A suitePackageList=() suiteArches=()
|
||||||
travisEnv=
|
travisEnv=
|
||||||
for version in "${versions[@]}"; do
|
for version in "${versions[@]}"; do
|
||||||
suite="${debianSuite[$version]}"
|
suite="${debianSuite[$version]}"
|
||||||
if [ -z "${suitePackageList["$suite"]:+isset}" ]; then
|
if [ -z "${suitePackageList["$suite"]:+isset}" ]; then
|
||||||
suitePackageList["$suite"]="$(curl -fsSL "${packagesBase}/${suite}-pgdg/main/binary-amd64/Packages.bz2" | bunzip2)"
|
suitePackageList["$suite"]="$(curl -fsSL "${packagesBase}/${suite}-pgdg/main/binary-amd64/Packages.bz2" | bunzip2)"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "${suiteArches["$suite"]:+isset}" ]; then
|
||||||
|
suiteArches["$suite"]="$(curl -fsSL "${packagesBase}/${suite}-pgdg/Release" | gawk -F ':[[:space:]]+' '$1 == "Architectures" { gsub(/[[:space:]]+/, "|", $2); print $2 }')"
|
||||||
|
fi
|
||||||
|
|
||||||
versionList="$(echo "${suitePackageList["$suite"]}"; curl -fsSL "${packagesBase}/${suite}-pgdg/${version}/binary-amd64/Packages.bz2" | bunzip2)"
|
versionList="$(echo "${suitePackageList["$suite"]}"; curl -fsSL "${packagesBase}/${suite}-pgdg/${version}/binary-amd64/Packages.bz2" | bunzip2)"
|
||||||
fullVersion="$(echo "$versionList" | awk -F ': ' '$1 == "Package" { pkg = $2 } $1 == "Version" && pkg == "postgresql-'"$version"'" { print $2; exit }' || true)"
|
fullVersion="$(echo "$versionList" | awk -F ': ' '$1 == "Package" { pkg = $2 } $1 == "Version" && pkg == "postgresql-'"$version"'" { print $2; exit }' || true)"
|
||||||
@ -48,6 +51,7 @@ for version in "${versions[@]}"; do
|
|||||||
sed -e 's/%%PG_MAJOR%%/'"$version"'/g;' \
|
sed -e 's/%%PG_MAJOR%%/'"$version"'/g;' \
|
||||||
-e 's/%%PG_VERSION%%/'"$fullVersion"'/g' \
|
-e 's/%%PG_VERSION%%/'"$fullVersion"'/g' \
|
||||||
-e 's/%%DEBIAN_SUITE%%/'"$suite"'/g' \
|
-e 's/%%DEBIAN_SUITE%%/'"$suite"'/g' \
|
||||||
|
-e 's/%%ARCH_LIST%%/'"${suiteArches["$suite"]}"'/g' \
|
||||||
Dockerfile-debian.template > "$version/Dockerfile"
|
Dockerfile-debian.template > "$version/Dockerfile"
|
||||||
if [ "$version" = '10' ]; then
|
if [ "$version" = '10' ]; then
|
||||||
# postgresql-contrib-10 package does not exist, but is provided by postgresql-10
|
# postgresql-contrib-10 package does not exist, but is provided by postgresql-10
|
||||||
@ -109,7 +113,8 @@ for version in "${versions[@]}"; do
|
|||||||
travisEnv="\n - VERSION=$version VARIANT=$variant$travisEnv"
|
travisEnv="\n - VERSION=$version VARIANT=$variant$travisEnv"
|
||||||
done
|
done
|
||||||
|
|
||||||
travisEnv='\n - VERSION='"$version$travisEnv"
|
travisEnv="\n - VERSION=$version FORCE_DEB_BUILD=1$travisEnv"
|
||||||
|
travisEnv="\n - VERSION=$version$travisEnv"
|
||||||
done
|
done
|
||||||
|
|
||||||
travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
|
travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
|
||||||
|
Reference in New Issue
Block a user