From ea490430aabd553f34656e8f0e846d2ed3c42930 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 15 Jul 2014 18:27:13 -0600 Subject: [PATCH] Add 9.1, 9.0, and 8.4 --- 8.4/Dockerfile | 32 ++++++++++++++++++++++++++++++++ 8.4/docker-entrypoint.sh | 18 ++++++++++++++++++ 9.0/Dockerfile | 32 ++++++++++++++++++++++++++++++++ 9.0/docker-entrypoint.sh | 18 ++++++++++++++++++ 9.1/Dockerfile | 32 ++++++++++++++++++++++++++++++++ 9.1/docker-entrypoint.sh | 18 ++++++++++++++++++ 6 files changed, 150 insertions(+) create mode 100644 8.4/Dockerfile create mode 100755 8.4/docker-entrypoint.sh create mode 100644 9.0/Dockerfile create mode 100755 9.0/docker-entrypoint.sh create mode 100644 9.1/Dockerfile create mode 100755 9.1/docker-entrypoint.sh diff --git a/8.4/Dockerfile b/8.4/Dockerfile new file mode 100644 index 0000000000..3e7263a78a --- /dev/null +++ b/8.4/Dockerfile @@ -0,0 +1,32 @@ +FROM debian:wheezy + +# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added +RUN groupadd -r postgres && useradd -r -g postgres postgres + +RUN apt-get update && apt-get install -y curl + +RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \ + && chmod +x /usr/local/bin/gosu + +ENV PG_MAJOR 8.4 +ENV PG_VERSION 8.4.21-1.pgdg70+1 + +RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \ + && curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \ + | apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764 + +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 + +ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH +ENV PGDATA /var/lib/postgresql/data +VOLUME /var/lib/postgresql/data + +ADD ./docker-entrypoint.sh / + +ENTRYPOINT ["/docker-entrypoint.sh"] + +EXPOSE 5432 +CMD ["postgres"] diff --git a/8.4/docker-entrypoint.sh b/8.4/docker-entrypoint.sh new file mode 100755 index 0000000000..5868bad075 --- /dev/null +++ b/8.4/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +if [ "$1" = 'postgres' ]; then + chown -R postgres "$PGDATA" + + if [ -z "$(ls -A "$PGDATA")" ]; then + gosu postgres initdb + + sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf + + { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + fi + + exec gosu postgres "$@" +fi + +exec "$@" diff --git a/9.0/Dockerfile b/9.0/Dockerfile new file mode 100644 index 0000000000..17564e8d66 --- /dev/null +++ b/9.0/Dockerfile @@ -0,0 +1,32 @@ +FROM debian:wheezy + +# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added +RUN groupadd -r postgres && useradd -r -g postgres postgres + +RUN apt-get update && apt-get install -y curl + +RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \ + && chmod +x /usr/local/bin/gosu + +ENV PG_MAJOR 9.0 +ENV PG_VERSION 9.0.17-1.pgdg70+1 + +RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \ + && curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \ + | apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764 + +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 + +ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH +ENV PGDATA /var/lib/postgresql/data +VOLUME /var/lib/postgresql/data + +ADD ./docker-entrypoint.sh / + +ENTRYPOINT ["/docker-entrypoint.sh"] + +EXPOSE 5432 +CMD ["postgres"] diff --git a/9.0/docker-entrypoint.sh b/9.0/docker-entrypoint.sh new file mode 100755 index 0000000000..5868bad075 --- /dev/null +++ b/9.0/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +if [ "$1" = 'postgres' ]; then + chown -R postgres "$PGDATA" + + if [ -z "$(ls -A "$PGDATA")" ]; then + gosu postgres initdb + + sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf + + { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + fi + + exec gosu postgres "$@" +fi + +exec "$@" diff --git a/9.1/Dockerfile b/9.1/Dockerfile new file mode 100644 index 0000000000..f6e8596f0c --- /dev/null +++ b/9.1/Dockerfile @@ -0,0 +1,32 @@ +FROM debian:wheezy + +# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added +RUN groupadd -r postgres && useradd -r -g postgres postgres + +RUN apt-get update && apt-get install -y curl + +RUN curl -o /usr/local/bin/gosu -SL 'https://github.com/tianon/gosu/releases/download/1.1/gosu' \ + && chmod +x /usr/local/bin/gosu + +ENV PG_MAJOR 9.1 +ENV PG_VERSION 9.1.13-1.pgdg70+1 + +RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list \ + && curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \ + | apt-key add - ED6D65271AACF0FF15D123036FB2A1C265FFB764 + +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 + +ENV PATH /usr/lib/postgresql/$PG_MAJOR/bin:$PATH +ENV PGDATA /var/lib/postgresql/data +VOLUME /var/lib/postgresql/data + +ADD ./docker-entrypoint.sh / + +ENTRYPOINT ["/docker-entrypoint.sh"] + +EXPOSE 5432 +CMD ["postgres"] diff --git a/9.1/docker-entrypoint.sh b/9.1/docker-entrypoint.sh new file mode 100755 index 0000000000..5868bad075 --- /dev/null +++ b/9.1/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +if [ "$1" = 'postgres' ]; then + chown -R postgres "$PGDATA" + + if [ -z "$(ls -A "$PGDATA")" ]; then + gosu postgres initdb + + sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf + + { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf + fi + + exec gosu postgres "$@" +fi + +exec "$@"