| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 | # vim:set ft=dockerfile:FROM debian:jessie# explicitly set user/group IDsRUN groupadd -r postgres --gid=999 && useradd -r -g postgres --uid=999 postgres# grab gosu for easy step-down from rootENV GOSU_VERSION 1.7RUN 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)" \	&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \	&& export GNUPGHOME="$(mktemp -d)" \	&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \	&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \	&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \	&& chmod +x /usr/local/bin/gosu \	&& gosu nobody true \	&& apt-get purge -y --auto-remove ca-certificates wget# make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by defaultRUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \	&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8ENV LANG en_US.utf8RUN mkdir /docker-entrypoint-initdb.dRUN set -ex; \# pub   4096R/ACCC4CF8 2011-10-13 [expires: 2019-07-02]#       Key fingerprint = B97B 0AFC AA1A 47F0 44F2  44A0 7FCC 7D46 ACCC 4CF8# uid                  PostgreSQL Debian Repository	key='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8'; \	export GNUPGHOME="$(mktemp -d)"; \	gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \	gpg --export "$key" > /etc/apt/trusted.gpg.d/postgres.gpg; \	rm -r "$GNUPGHOME"; \	apt-key listENV PG_MAJOR 9.6ENV PG_VERSION 9.6.2-1.pgdg80+1RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.listRUN 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/*# 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/ \	&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sampleRUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod g+s /var/run/postgresqlENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATHENV PGDATA /var/lib/postgresql/dataRUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA" # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)VOLUME /var/lib/postgresql/dataCOPY docker-entrypoint.sh /usr/local/bin/RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compatENTRYPOINT ["docker-entrypoint.sh"]EXPOSE 5432CMD ["postgres"]
 |